Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fetch module state by class in _WindowsConsoleIO.close
  • Loading branch information
erlend-aasland committed May 10, 2023
commit cc1c8f8854275a2cbe29c3c912e11cc625718c46
14 changes: 9 additions & 5 deletions Modules/_io/clinic/winconsoleio.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions Modules/_io/winconsoleio.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ internal_close(winconsoleio *self)

/*[clinic input]
_io._WindowsConsoleIO.close
cls: defining_class
/

Close the console object.

Expand All @@ -188,13 +190,15 @@ close() may be called more than once without error.
[clinic start generated code]*/

static PyObject *
_io__WindowsConsoleIO_close_impl(winconsoleio *self)
/*[clinic end generated code: output=27ef95b66c29057b input=68c4e5754f8136c2]*/
_io__WindowsConsoleIO_close_impl(winconsoleio *self, PyTypeObject *cls)
/*[clinic end generated code: output=e50c1808c063e1e2 input=161001bd2a649a4b]*/
{
PyObject *res;
PyObject *exc;
int rc;
res = PyObject_CallMethodOneArg((PyObject*)&PyRawIOBase_Type,

_PyIO_State *state = get_io_state_by_cls(cls);
res = PyObject_CallMethodOneArg((PyObject*)state->PyRawIOBase_Type,
&_Py_ID(close), (PyObject*)self);
if (!self->closefd) {
self->fd = -1;
Expand Down