Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
23db935b
Kaydet (Commit)
23db935b
authored
Haz 29, 2018
tarafından
Zackery Spytz
Kaydeden (comit)
Serhiy Storchaka
Haz 29, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-25862: Fix assertion failures in io.TextIOWrapper.tell(). (GH-3918)
üst
bda9c3ea
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
0 deletions
+19
-0
_pyio.py
Lib/_pyio.py
+1
-0
test_io.py
Lib/test/test_io.py
+11
-0
2017-10-07-10-13-15.bpo-25862.FPYBA5.rst
...ore and Builtins/2017-10-07-10-13-15.bpo-25862.FPYBA5.rst
+2
-0
textio.c
Modules/_io/textio.c
+5
-0
No files found.
Lib/_pyio.py
Dosyayı görüntüle @
23db935b
...
...
@@ -2149,6 +2149,7 @@ class TextIOWrapper(TextIOBase):
self
.
buffer
.
write
(
b
)
if
self
.
_line_buffering
and
(
haslf
or
"
\r
"
in
s
):
self
.
flush
()
self
.
_set_decoded_chars
(
''
)
self
.
_snapshot
=
None
if
self
.
_decoder
:
self
.
_decoder
.
reset
()
...
...
Lib/test/test_io.py
Dosyayı görüntüle @
23db935b
...
...
@@ -3549,6 +3549,17 @@ class TextIOWrapperTest(unittest.TestCase):
expected
=
'linesep'
+
os
.
linesep
+
'LF
\n
LF
\n
CR
\r
CRLF
\r\n
'
self
.
assertEqual
(
txt
.
detach
()
.
getvalue
()
.
decode
(
'ascii'
),
expected
)
def
test_issue25862
(
self
):
# Assertion failures occurred in tell() after read() and write().
t
=
self
.
TextIOWrapper
(
self
.
BytesIO
(
b
'test'
),
encoding
=
'ascii'
)
t
.
read
(
1
)
t
.
read
()
t
.
tell
()
t
=
self
.
TextIOWrapper
(
self
.
BytesIO
(
b
'test'
),
encoding
=
'ascii'
)
t
.
read
(
1
)
t
.
write
(
'x'
)
t
.
tell
()
class
MemviewBytesIO
(
io
.
BytesIO
):
'''A BytesIO object whose read method returns memoryviews
...
...
Misc/NEWS.d/next/Core and Builtins/2017-10-07-10-13-15.bpo-25862.FPYBA5.rst
0 → 100644
Dosyayı görüntüle @
23db935b
Fix assertion failures in the ``tell()`` method of ``io.TextIOWrapper``.
Patch by Zackery Spytz.
Modules/_io/textio.c
Dosyayı görüntüle @
23db935b
...
...
@@ -694,6 +694,9 @@ typedef struct
PyObject
*
dict
;
}
textio
;
static
void
textiowrapper_set_decoded_chars
(
textio
*
self
,
PyObject
*
chars
);
/* A couple of specialized cases in order to bypass the slow incremental
encoding methods for the most popular encodings. */
...
...
@@ -1606,6 +1609,7 @@ _io_TextIOWrapper_write_impl(textio *self, PyObject *text)
Py_DECREF
(
ret
);
}
textiowrapper_set_decoded_chars
(
self
,
NULL
);
Py_CLEAR
(
self
->
snapshot
);
if
(
self
->
decoder
)
{
...
...
@@ -1835,6 +1839,7 @@ _io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n)
if
(
result
==
NULL
)
goto
fail
;
textiowrapper_set_decoded_chars
(
self
,
NULL
);
Py_CLEAR
(
self
->
snapshot
);
return
result
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment