Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9e435e

Browse files
committed
check for errors after PyLong_Ssize_t
patch from Victor Stinner #3977 reviewed by Amaury
1 parent a8a9304 commit c9e435e

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Modules/_stringio.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ stringio_truncate(StringIOObject *self, PyObject *args)
177177

178178
if (PyLong_Check(arg)) {
179179
size = PyLong_AsSsize_t(arg);
180+
if (size == -1 && PyErr_Occurred())
181+
return NULL;
182+
if (size == -1 && PyErr_Occurred())
183+
return NULL;
180184
}
181185
else if (arg == Py_None) {
182186
/* Truncate to current position if no argument is passed. */

0 commit comments

Comments
 (0)