summaryrefslogtreecommitdiffstats
path: root/Modules/_io/iobase.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-09-17 11:23:31 (GMT)
committerGitHub <noreply@github.com>2023-09-17 11:23:31 (GMT)
commitadd16f1a5e4013f97d33cc677dc008e8199f5b11 (patch)
tree2c187adbae2766f942e35780950a526dfe84ff48 /Modules/_io/iobase.c
parente57ecf6bbc59f999d27b125ea51b042c24a07bd9 (diff)
downloadcpython-add16f1a5e4013f97d33cc677dc008e8199f5b11.zip
cpython-add16f1a5e4013f97d33cc677dc008e8199f5b11.tar.gz
cpython-add16f1a5e4013f97d33cc677dc008e8199f5b11.tar.bz2
gh-108511: Add C API functions which do not silently ignore errors (GH-109025)
Add the following functions: * PyObject_HasAttrWithError() * PyObject_HasAttrStringWithError() * PyMapping_HasKeyWithError() * PyMapping_HasKeyStringWithError()
Diffstat (limited to 'Modules/_io/iobase.c')
-rw-r--r--Modules/_io/iobase.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c
index 34fcd70..78f0f94 100644
--- a/Modules/_io/iobase.c
+++ b/Modules/_io/iobase.c
@@ -148,13 +148,9 @@ _io__IOBase_truncate_impl(PyObject *self, PyTypeObject *cls,
static int
iobase_is_closed(PyObject *self)
{
- PyObject *res;
- int ret;
/* This gets the derived attribute, which is *not* __IOBase_closed
in most cases! */
- ret = PyObject_GetOptionalAttr(self, &_Py_ID(__IOBase_closed), &res);
- Py_XDECREF(res);
- return ret;
+ return PyObject_HasAttrWithError(self, &_Py_ID(__IOBase_closed));
}
/* Flush and close methods */