summaryrefslogtreecommitdiffstats
path: root/Modules/_io
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-08-15 21:18:25 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-08-15 21:18:25 (GMT)
commit6f430e496339aea3e688165340456b555d5e1035 (patch)
tree197393decf924def07e006f3e35cf21f2fec0f08 /Modules/_io
parentdd7c55250d67de4d430a0c51dba4f3c0cd8f6ed3 (diff)
downloadcpython-6f430e496339aea3e688165340456b555d5e1035.zip
cpython-6f430e496339aea3e688165340456b555d5e1035.tar.gz
cpython-6f430e496339aea3e688165340456b555d5e1035.tar.bz2
Issue #15604: Update uses of PyObject_IsTrue() to check for and handle errors correctly.
Patch by Serhiy Storchaka.
Diffstat (limited to 'Modules/_io')
-rw-r--r--Modules/_io/textio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index 2d516ee..4904842 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -1046,8 +1046,11 @@ textiowrapper_init(textio *self, PyObject *args, PyObject *kwds)
res = PyObject_CallMethod(buffer, "seekable", NULL);
if (res == NULL)
goto error;
- self->seekable = self->telling = PyObject_IsTrue(res);
+ r = PyObject_IsTrue(res);
Py_DECREF(res);
+ if (r < 0)
+ goto error;
+ self->seekable = self->telling = r;
self->has_read1 = PyObject_HasAttrString(buffer, "read1");