summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathon Reinhart <JonathonReinhart@users.noreply.github.com>2024-01-16 16:27:17 (GMT)
committerGitHub <noreply@github.com>2024-01-16 16:27:17 (GMT)
commite454f9383c5ea629a917dfea791da0bb92b90d8e (patch)
treef41eb747f0330aa91b5efa1a99ed4aaaa23fbe09
parentc77f552ec02040dfe14a0a3cb743d96eedffadec (diff)
downloadcpython-e454f9383c5ea629a917dfea791da0bb92b90d8e.zip
cpython-e454f9383c5ea629a917dfea791da0bb92b90d8e.tar.gz
cpython-e454f9383c5ea629a917dfea791da0bb92b90d8e.tar.bz2
Fix an incorrect comment in iobase_is_closed (GH-102952)
This comment appears to have been mistakenly copied from what is now called iobase_check_closed() in commit 4d9aec022063. Also unite the iobase_check_closed() code with the relevant comment. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
-rw-r--r--Modules/_io/iobase.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c
index 4da8e5b..184e0b7 100644
--- a/Modules/_io/iobase.c
+++ b/Modules/_io/iobase.c
@@ -66,12 +66,19 @@ PyDoc_STRVAR(iobase_doc,
"with open('spam.txt', 'r') as fp:\n"
" fp.write('Spam and eggs!')\n");
-/* Use this macro whenever you want to check the internal `closed` status
+
+/* Internal methods */
+
+/* Use this function whenever you want to check the internal `closed` status
of the IOBase object rather than the virtual `closed` attribute as returned
by whatever subclass. */
+static int
+iobase_is_closed(PyObject *self)
+{
+ return PyObject_HasAttrWithError(self, &_Py_ID(__IOBase_closed));
+}
-/* Internal methods */
static PyObject *
iobase_unsupported(_PyIO_State *state, const char *message)
{
@@ -145,14 +152,6 @@ _io__IOBase_truncate_impl(PyObject *self, PyTypeObject *cls,
return iobase_unsupported(state, "truncate");
}
-static int
-iobase_is_closed(PyObject *self)
-{
- /* This gets the derived attribute, which is *not* __IOBase_closed
- in most cases! */
- return PyObject_HasAttrWithError(self, &_Py_ID(__IOBase_closed));
-}
-
/* Flush and close methods */
/*[clinic input]