gh-101469: Optimise get_io_state() by using _PyModule_GetState() (GH-101470)

Automerge-Triggered-By: GH:erlend-aasland
This commit is contained in:
Erlend E. Aasland 2023-01-31 19:19:11 +01:00 committed by GitHub
parent 20c11f2e60
commit f80db6cef0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View 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;
}