diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-09-30 02:18:09 +0000 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-09-30 02:18:09 +0000 |
commit | a8a93042dcfb6673da1a67726e5028c7582099ea (patch) | |
tree | c8e097854723da1cddf587321661d705cba98263 /Modules/_bytesio.c | |
parent | cb9a5517d0806a55aa9432b1305537dd8f5c062b (diff) | |
download | cpython-git-a8a93042dcfb6673da1a67726e5028c7582099ea.tar.gz |
Merged revisions 66693 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r66693 | benjamin.peterson | 2008-09-29 21:11:07 -0500 (Mon, 29 Sep 2008) | 4 lines
Victor Stinner's patches to check the return result of PyLong_Ssize_t
reviewed by Amaury
........
Diffstat (limited to 'Modules/_bytesio.c')
-rw-r--r-- | Modules/_bytesio.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/_bytesio.c b/Modules/_bytesio.c index d7d2667a36..48fe50a094 100644 --- a/Modules/_bytesio.c +++ b/Modules/_bytesio.c @@ -221,6 +221,8 @@ bytesio_read(BytesIOObject *self, PyObject *args) if (PyLong_Check(arg)) { size = PyLong_AsSsize_t(arg); + if (size == -1 && PyErr_Occurred()) + return NULL; } else if (arg == Py_None) { /* Read until EOF is reached, by default. */ @@ -288,6 +290,8 @@ bytesio_readline(BytesIOObject *self, PyObject *args) if (PyLong_Check(arg)) { size = PyLong_AsSsize_t(arg); + if (size == -1 && PyErr_Occurred()) + return NULL; } else if (arg == Py_None) { /* No size limit, by default. */ @@ -332,6 +336,8 @@ bytesio_readlines(BytesIOObject *self, PyObject *args) if (PyLong_Check(arg)) { maxsize = PyLong_AsSsize_t(arg); + if (maxsize == -1 && PyErr_Occurred()) + return NULL; } else if (arg == Py_None) { /* No size limit, by default. */ @@ -415,6 +421,8 @@ bytesio_truncate(BytesIOObject *self, PyObject *args) if (PyLong_Check(arg)) { size = PyLong_AsSsize_t(arg); + if (size == -1 && PyErr_Occurred()) + return NULL; } else if (arg == Py_None) { /* Truncate to current position if no argument is passed. */ |