mirror of
https://github.com/python/cpython.git
synced 2026-01-06 23:42:34 +00:00
check for errors after PyLong_Ssize_t
patch from Victor Stinner #3977 reviewed by Amaury
This commit is contained in:
parent
a8a93042dc
commit
c9e435ee2b
1 changed files with 4 additions and 0 deletions
|
|
@ -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. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue