Mercurial > cpython-lru_cache-weakref
diff Modules/_stringio.c @ 49353:598d19936186
check for errors after PyLong_Ssize_t
patch from Victor Stinner #3977
reviewed by Amaury
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Tue, 30 Sep 2008 02:22:04 +0000 |
| parents | 1bfea956d0d7 |
| children | 1f4ea0229ec6 |
line wrap: on
line diff
--- a/Modules/_stringio.c Tue Sep 30 02:18:09 2008 +0000 +++ b/Modules/_stringio.c Tue Sep 30 02:22:04 2008 +0000 @@ -177,6 +177,10 @@ 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. */
