summaryrefslogtreecommitdiffstats
path: root/Modules/_io/textio.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-08-15 21:20:39 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-08-15 21:20:39 (GMT)
commit721738fbee8d75dab5a5d3c4f3dbd7c72d76925e (patch)
treec0e693ed7f2e6c44d48555f3cc4d8775ac8e14bb /Modules/_io/textio.c
parent9351117139363f3e600c541bc88139702a055db8 (diff)
parent6f430e496339aea3e688165340456b555d5e1035 (diff)
downloadcpython-721738fbee8d75dab5a5d3c4f3dbd7c72d76925e.zip
cpython-721738fbee8d75dab5a5d3c4f3dbd7c72d76925e.tar.gz
cpython-721738fbee8d75dab5a5d3c4f3dbd7c72d76925e.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/textio.c')
-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 421dc50..fb9b674 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -1056,8 +1056,11 @@ textiowrapper_init(textio *self, PyObject *args, PyObject *kwds)
res = _PyObject_CallMethodId(buffer, &PyId_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_HasAttrId(buffer, &PyId_read1);