diff options
author | Victor Stinner <vstinner@python.org> | 2021-04-21 22:52:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-21 22:52:52 (GMT) |
commit | cdad2724e6f7426372901cc5dedd8a462ba046a6 (patch) | |
tree | ca6a34bfdc6c05ea86d2ff2686ebd116750b2305 /Modules/_sre.c | |
parent | a32f8fe7133aad4f3cf8946534e3b79a5f2659da (diff) | |
download | cpython-cdad2724e6f7426372901cc5dedd8a462ba046a6.zip cpython-cdad2724e6f7426372901cc5dedd8a462ba046a6.tar.gz cpython-cdad2724e6f7426372901cc5dedd8a462ba046a6.tar.bz2 |
bpo-40137: Add pycore_moduleobject.h internal header (GH-25507)
Add pycore_moduleobject.h internal header file with static inline
functions to access module members:
* _PyModule_GetDict()
* _PyModule_GetDef()
* _PyModule_GetState()
These functions don't check at runtime if their argument has a valid
type and can be inlined even if Python is not built with LTO.
_PyType_GetModuleByDef() uses _PyModule_GetDef().
Replace PyModule_GetState() with _PyModule_GetState() in the
extension modules, considered as performance sensitive:
* _abc
* _functools
* _operator
* _pickle
* _queue
* _random
* _sre
* _struct
* _thread
* _winapi
* array
* posix
The following extensions are now built with the Py_BUILD_CORE_MODULE
macro defined, to be able to use the internal pycore_moduleobject.h
header: _abc, array, _operator, _queue, _sre, _struct.
Diffstat (limited to 'Modules/_sre.c')
-rw-r--r-- | Modules/_sre.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c index 57faf7b..d4bfff6 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -42,6 +42,7 @@ static const char copyright[] = #include "Python.h" #include "pycore_long.h" // _PyLong_GetZero() +#include "pycore_moduleobject.h" // _PyModule_GetState() #include "structmember.h" // PyMemberDef #include "sre.h" @@ -258,7 +259,7 @@ typedef struct { static _sremodulestate * get_sre_module_state(PyObject *m) { - _sremodulestate *state = (_sremodulestate *)PyModule_GetState(m); + _sremodulestate *state = (_sremodulestate *)_PyModule_GetState(m); assert(state); return state; } |