From: Erlend E. Aasland Date: Tue, 31 Jan 2023 18:19:11 +0000 (+0100) Subject: gh-101469: Optimise get_io_state() by using _PyModule_GetState() (GH-101470) X-Git-Tag: v3.12.0a5~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f80db6cef075186f888a85258ccf2164bf148921;p=thirdparty%2FPython%2Fcpython.git gh-101469: Optimise get_io_state() by using _PyModule_GetState() (GH-101470) Automerge-Triggered-By: GH:erlend-aasland --- diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c index af5950cf66c1..175fa97479d2 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; }