From: Benjamin Peterson Date: Tue, 30 Sep 2008 02:22:04 +0000 (+0000) Subject: check for errors after PyLong_Ssize_t X-Git-Tag: v3.0rc2~127 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c9e435ee2b3e9fc883799480ad1fdb506c8f6a3f;p=thirdparty%2FPython%2Fcpython.git check for errors after PyLong_Ssize_t patch from Victor Stinner #3977 reviewed by Amaury --- diff --git a/Modules/_stringio.c b/Modules/_stringio.c index 83fc79ef30ca..d29fe64eba70 100644 --- a/Modules/_stringio.c +++ b/Modules/_stringio.c @@ -177,6 +177,10 @@ stringio_truncate(StringIOObject *self, PyObject *args) if (PyLong_Check(arg)) { size = PyLong_AsSsize_t(arg); + if (size == -1 && PyErr_Occurred()) + return NULL; + if (size == -1 && PyErr_Occurred()) + return NULL; } else if (arg == Py_None) { /* Truncate to current position if no argument is passed. */