Skip to content

Commit c03491a

Browse files
Fixup winconsoleio.c
1 parent 5390aed commit c03491a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Modules/_io/winconsoleio.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ typedef struct {
156156
wchar_t wbuf;
157157
} winconsoleio;
158158

159-
PyTypeObject PyWindowsConsoleIO_Type;
160-
161159
int
162160
_PyWindowsConsoleIO_closed(PyObject *self)
163161
{
@@ -265,7 +263,10 @@ _io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj,
265263
int fd_is_own = 0;
266264
HANDLE handle = NULL;
267265

268-
assert(PyObject_TypeCheck(self, (PyTypeObject *)&PyWindowsConsoleIO_Type));
266+
#ifdef Py_DEBUG
267+
_PyIO_State *state = find_io_state_by_def(Py_TYPE(self));
268+
assert(PyObject_TypeCheck(self, state->PyWindowsConsoleIO_Type));
269+
#endif
269270
if (self->fd >= 0) {
270271
if (self->closefd) {
271272
/* Have to close the existing file first. */

0 commit comments

Comments
 (0)