mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-101476: Add _PyType_GetModuleState (GH-101477)
For fast module state access from heap type methods.
This commit is contained in:
parent
d43c2652d4
commit
ccd98a3146
2 changed files with 18 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "pycore_call.h" // _PyObject_CallNoArgs()
|
||||
#include "pycore_long.h" // _PyLong_GetZero()
|
||||
#include "pycore_moduleobject.h" // _PyModule_GetState()
|
||||
#include "pycore_typeobject.h" // _PyType_GetModuleState()
|
||||
#include "pycore_object.h" // _PyObject_GC_TRACK()
|
||||
#include "pycore_tuple.h" // _PyTuple_ITEMS()
|
||||
#include "structmember.h" // PyMemberDef
|
||||
|
@ -48,7 +49,7 @@ get_module_state(PyObject *mod)
|
|||
static inline itertools_state *
|
||||
get_module_state_by_cls(PyTypeObject *cls)
|
||||
{
|
||||
void *state = PyType_GetModuleState(cls);
|
||||
void *state = _PyType_GetModuleState(cls);
|
||||
assert(state != NULL);
|
||||
return (itertools_state *)state;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue