Issue #15604: Update uses of PyObject_IsTrue() to check for and handle errors correctly.

Patch by Serhiy Storchaka.
This commit is contained in:
Antoine Pitrou 2012-08-15 23:18:25 +02:00
parent dd7c55250d
commit 6f430e4963
11 changed files with 87 additions and 39 deletions

View file

@ -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");