Skip to content

Commit e454f93

Browse files
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 4d9aec0. Also unite the iobase_check_closed() code with the relevant comment. Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent c77f552 commit e454f93

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

Modules/_io/iobase.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,19 @@ PyDoc_STRVAR(iobase_doc,
6666
"with open('spam.txt', 'r') as fp:\n"
6767
" fp.write('Spam and eggs!')\n");
6868

69-
/* Use this macro whenever you want to check the internal `closed` status
69+
70+
/* Internal methods */
71+
72+
/* Use this function whenever you want to check the internal `closed` status
7073
of the IOBase object rather than the virtual `closed` attribute as returned
7174
by whatever subclass. */
7275

76+
static int
77+
iobase_is_closed(PyObject *self)
78+
{
79+
return PyObject_HasAttrWithError(self, &_Py_ID(__IOBase_closed));
80+
}
7381

74-
/* Internal methods */
7582
static PyObject *
7683
iobase_unsupported(_PyIO_State *state, const char *message)
7784
{
@@ -145,14 +152,6 @@ _io__IOBase_truncate_impl(PyObject *self, PyTypeObject *cls,
145152
return iobase_unsupported(state, "truncate");
146153
}
147154

148-
static int
149-
iobase_is_closed(PyObject *self)
150-
{
151-
/* This gets the derived attribute, which is *not* __IOBase_closed
152-
in most cases! */
153-
return PyObject_HasAttrWithError(self, &_Py_ID(__IOBase_closed));
154-
}
155-
156155
/* Flush and close methods */
157156

158157
/*[clinic input]

0 commit comments

Comments
 (0)