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
988512cf
Kaydet (Commit)
988512cf
authored
May 25, 2011
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
(Merge 3.1) Issue #12175: RawIOBase.readall() now returns None if read()
returns None.
üst
4767114e
a80987f2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
5 deletions
+22
-5
_pyio.py
Lib/_pyio.py
+4
-0
test_io.py
Lib/test/test_io.py
+5
-2
NEWS
Misc/NEWS
+5
-3
iobase.c
Modules/_io/iobase.c
+8
-0
No files found.
Lib/_pyio.py
Dosyayı görüntüle @
988512cf
...
@@ -558,7 +558,11 @@ class RawIOBase(IOBase):
...
@@ -558,7 +558,11 @@ class RawIOBase(IOBase):
if
not
data
:
if
not
data
:
break
break
res
+=
data
res
+=
data
if
res
:
return
bytes
(
res
)
return
bytes
(
res
)
else
:
# b'' or None
return
data
def
readinto
(
self
,
b
):
def
readinto
(
self
,
b
):
"""Read up to len(b) bytes into bytearray b.
"""Read up to len(b) bytes into bytearray b.
...
...
Lib/test/test_io.py
Dosyayı görüntüle @
988512cf
...
@@ -827,14 +827,17 @@ class BufferedReaderTest(unittest.TestCase, CommonBufferedTests):
...
@@ -827,14 +827,17 @@ class BufferedReaderTest(unittest.TestCase, CommonBufferedTests):
# Inject some None's in there to simulate EWOULDBLOCK
# Inject some None's in there to simulate EWOULDBLOCK
rawio
=
self
.
MockRawIO
((
b
"abc"
,
b
"d"
,
None
,
b
"efg"
,
None
,
None
,
None
))
rawio
=
self
.
MockRawIO
((
b
"abc"
,
b
"d"
,
None
,
b
"efg"
,
None
,
None
,
None
))
bufio
=
self
.
tp
(
rawio
)
bufio
=
self
.
tp
(
rawio
)
self
.
assertEqual
(
b
"abcd"
,
bufio
.
read
(
6
))
self
.
assertEqual
(
b
"abcd"
,
bufio
.
read
(
6
))
self
.
assertEqual
(
b
"e"
,
bufio
.
read
(
1
))
self
.
assertEqual
(
b
"e"
,
bufio
.
read
(
1
))
self
.
assertEqual
(
b
"fg"
,
bufio
.
read
())
self
.
assertEqual
(
b
"fg"
,
bufio
.
read
())
self
.
assertEqual
(
b
""
,
bufio
.
peek
(
1
))
self
.
assertEqual
(
b
""
,
bufio
.
peek
(
1
))
self
.
assert
True
(
None
is
bufio
.
read
())
self
.
assert
IsNone
(
bufio
.
read
())
self
.
assertEqual
(
b
""
,
bufio
.
read
())
self
.
assertEqual
(
b
""
,
bufio
.
read
())
rawio
=
self
.
MockRawIO
((
b
"a"
,
None
,
None
))
self
.
assertEqual
(
b
"a"
,
rawio
.
readall
())
self
.
assertIsNone
(
rawio
.
readall
())
def
test_read_past_eof
(
self
):
def
test_read_past_eof
(
self
):
rawio
=
self
.
MockRawIO
((
b
"abc"
,
b
"d"
,
b
"efg"
))
rawio
=
self
.
MockRawIO
((
b
"abc"
,
b
"d"
,
b
"efg"
))
bufio
=
self
.
tp
(
rawio
)
bufio
=
self
.
tp
(
rawio
)
...
...
Misc/NEWS
Dosyayı görüntüle @
988512cf
...
@@ -13,6 +13,11 @@ Core and Builtins
...
@@ -13,6 +13,11 @@ Core and Builtins
Library
Library
-------
-------
- Issue #12175: RawIOBase.readall() now returns None if read() returns None.
- Issue #12175: FileIO.readall() now raises a ValueError instead of an IOError
if the file is closed.
- Issue #12070: Fix the Makefile parser of the sysconfig module to handle
- Issue #12070: Fix the Makefile parser of the sysconfig module to handle
correctly references to "bogus variable" (e.g. "prefix=$/opt/python").
correctly references to "bogus variable" (e.g. "prefix=$/opt/python").
...
@@ -731,9 +736,6 @@ Core and Builtins
...
@@ -731,9 +736,6 @@ Core and Builtins
Library
Library
-------
-------
- Issue #12175: FileIO.readall() now raises a ValueError instead of an IOError
if the file is closed.
- Issue #10916: mmap should not segfault when a file is mapped using 0 as length
- Issue #10916: mmap should not segfault when a file is mapped using 0 as length
and a non-zero offset, and an attempt to read past the end of file is made
and a non-zero offset, and an attempt to read past the end of file is made
(IndexError is raised instead). Patch by Ross Lagerwall.
(IndexError is raised instead). Patch by Ross Lagerwall.
...
...
Modules/_io/iobase.c
Dosyayı görüntüle @
988512cf
...
@@ -815,6 +815,14 @@ rawiobase_readall(PyObject *self, PyObject *args)
...
@@ -815,6 +815,14 @@ rawiobase_readall(PyObject *self, PyObject *args)
Py_DECREF
(
chunks
);
Py_DECREF
(
chunks
);
return
NULL
;
return
NULL
;
}
}
if
(
data
==
Py_None
)
{
if
(
PyList_GET_SIZE
(
chunks
)
==
0
)
{
Py_DECREF
(
chunks
);
return
data
;
}
Py_DECREF
(
data
);
break
;
}
if
(
!
PyBytes_Check
(
data
))
{
if
(
!
PyBytes_Check
(
data
))
{
Py_DECREF
(
chunks
);
Py_DECREF
(
chunks
);
Py_DECREF
(
data
);
Py_DECREF
(
data
);
...
...
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