summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend.aasland@protonmail.com>2023-01-31 18:19:11 (GMT)
committerGitHub <noreply@github.com>2023-01-31 18:19:11 (GMT)
commitf80db6cef075186f888a85258ccf2164bf148921 (patch)
tree30173ab4ea3ab8e5200cb7e342501bc7f2b3cbd3 /Modules
parent20c11f2e600e1c0bf42de4d6f2fb3ce5ccc2587c (diff)
downloadcpython-f80db6cef075186f888a85258ccf2164bf148921.zip
cpython-f80db6cef075186f888a85258ccf2164bf148921.tar.gz
cpython-f80db6cef075186f888a85258ccf2164bf148921.tar.bz2
gh-101469: Optimise get_io_state() by using _PyModule_GetState() (GH-101470)
Automerge-Triggered-By: GH:erlend-aasland
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_io/_iomodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c
index af5950c..175fa97 100644
--- a/Modules/_io/_iomodule.c
+++ b/Modules/_io/_iomodule.c
@@ -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;
}