diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-12-13 19:25:34 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-12-13 19:25:34 (GMT) |
commit | bf5ff765970a15255a06e4a4ee7f18b5745079ad (patch) | |
tree | ac106a4885c12c27a624f296ee0a08d5d6b195c4 /Modules/_io/bufferedio.c | |
parent | 229663775dd6c869e8daceea6d92af638afa520f (diff) | |
download | cpython-bf5ff765970a15255a06e4a4ee7f18b5745079ad.zip cpython-bf5ff765970a15255a06e4a4ee7f18b5745079ad.tar.gz cpython-bf5ff765970a15255a06e4a4ee7f18b5745079ad.tar.bz2 |
Merged revisions 76805 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76805 | benjamin.peterson | 2009-12-13 13:19:07 -0600 (Sun, 13 Dec 2009) | 7 lines
accept None as the same as having passed no argument in file types #7349
This is for consistency with imitation file objects like StringIO and BytesIO.
This commit also adds a few tests, where they were lacking for concerned
methods.
........
Diffstat (limited to 'Modules/_io/bufferedio.c')
-rw-r--r-- | Modules/_io/bufferedio.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index 39c778c..fb651a7 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -720,7 +720,7 @@ buffered_read(buffered *self, PyObject *args) PyObject *res; CHECK_INITIALIZED(self) - if (!PyArg_ParseTuple(args, "|n:read", &n)) { + if (!PyArg_ParseTuple(args, "|O&:read", &_PyIO_ConvertSsize_t, &n)) { return NULL; } if (n < -1) { @@ -953,10 +953,8 @@ buffered_readline(buffered *self, PyObject *args) Py_ssize_t limit = -1; CHECK_INITIALIZED(self) - - if (!PyArg_ParseTuple(args, "|n:readline", &limit)) { + if (!PyArg_ParseTuple(args, "|O&:readline", &_PyIO_ConvertSsize_t, &limit)) return NULL; - } return _buffered_readline(self, limit); } |