summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-09-30 02:22:04 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-09-30 02:22:04 (GMT)
commitc9e435ee2b3e9fc883799480ad1fdb506c8f6a3f (patch)
tree347a762539143403e00a6b460ff3f4039aa09782 /Modules
parenta8a93042dcfb6673da1a67726e5028c7582099ea (diff)
downloadcpython-c9e435ee2b3e9fc883799480ad1fdb506c8f6a3f.zip
cpython-c9e435ee2b3e9fc883799480ad1fdb506c8f6a3f.tar.gz
cpython-c9e435ee2b3e9fc883799480ad1fdb506c8f6a3f.tar.bz2
check for errors after PyLong_Ssize_t
patch from Victor Stinner #3977 reviewed by Amaury
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_stringio.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_stringio.c b/Modules/_stringio.c
index 83fc79e..d29fe64 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. */