diff Modules/_bytesio.c @ 49352:b2801aca9d6b

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 ........
author Benjamin Peterson <benjamin@python.org>
date Tue, 30 Sep 2008 02:18:09 +0000
parents 94f64f11fdd0
children 87fbbf22adf3
line wrap: on
line diff
--- a/Modules/_bytesio.c	Tue Sep 30 02:08:36 2008 +0000
+++ b/Modules/_bytesio.c	Tue Sep 30 02:18:09 2008 +0000
@@ -221,6 +221,8 @@
 
     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 @@
 
     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 @@
 
     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 @@
 
     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. */