Issue #15604: Update uses of PyObject_IsTrue() to check for and handle errors correctly.
Patch by Serhiy Storchaka.
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index 2662e4b..1746604 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -1013,8 +1013,11 @@
     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->encoding_start_of_stream = 0;
     if (self->seekable && self->encoder) {