Skip to content

Commit bd4f58a

Browse files
pythongh-101469: Optimise get_io_state() by using _PyModule_GetState()
1 parent 666c084 commit bd4f58a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎Modules/_io/_iomodule.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "Python.h"
1212
#include "_iomodule.h"
1313
#include "pycore_pystate.h" // _PyInterpreterState_GET()
14+
#include "pycore_moduleobject.h" // _PyModule_GetState()
1415

1516
#ifdef HAVE_SYS_TYPES_H
1617
#include <sys/types.h>
@@ -560,7 +561,7 @@ PyNumber_AsOff_t(PyObject *item, PyObject *err)
560561
static inline _PyIO_State*
561562
get_io_state(PyObject *module)
562563
{
563-
void *state = PyModule_GetState(module);
564+
void *state = _PyModule_GetState(module);
564565
assert(state != NULL);
565566
return (_PyIO_State *)state;
566567
}

0 commit comments

Comments
 (0)