Skip to content

Commit f80db6c

Browse files
gh-101469: Optimise get_io_state() by using _PyModule_GetState() (GH-101470)
Automerge-Triggered-By: GH:erlend-aasland
1 parent 20c11f2 commit f80db6c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Modules/_io/_iomodule.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define PY_SSIZE_T_CLEAN
1111
#include "Python.h"
1212
#include "_iomodule.h"
13+
#include "pycore_moduleobject.h" // _PyModule_GetState()
1314
#include "pycore_pystate.h" // _PyInterpreterState_GET()
1415

1516
#ifdef HAVE_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)