]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-101469: Optimise get_io_state() by using _PyModule_GetState() (GH-101470)
authorErlend E. Aasland <erlend.aasland@protonmail.com>
Tue, 31 Jan 2023 18:19:11 +0000 (19:19 +0100)
committerGitHub <noreply@github.com>
Tue, 31 Jan 2023 18:19:11 +0000 (10:19 -0800)
Automerge-Triggered-By: GH:erlend-aasland
Modules/_io/_iomodule.c

index af5950cf66c17826213506241b33ba3b05d90385..175fa97479d27d8e07d950f3d85f321122dbd872 100644 (file)
@@ -10,6 +10,7 @@
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
 #include "_iomodule.h"
+#include "pycore_moduleobject.h"  // _PyModule_GetState()
 #include "pycore_pystate.h"       // _PyInterpreterState_GET()
 
 #ifdef HAVE_SYS_TYPES_H
@@ -560,7 +561,7 @@ PyNumber_AsOff_t(PyObject *item, PyObject *err)
 static inline _PyIO_State*
 get_io_state(PyObject *module)
 {
-    void *state = PyModule_GetState(module);
+    void *state = _PyModule_GetState(module);
     assert(state != NULL);
     return (_PyIO_State *)state;
 }