summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_moduleobject.h
Commit message (Collapse)AuthorAgeFilesLines
* gh-140550: Use a bool for the Py_mod_gil value (GH-141519)Petr Viktorin2025-11-141-1/+1
| | | | | | | | This needs a single bit, but was stored as a void* in the module struct. This didn't matter due to packing, but now that there's another bool in the struct, we can save a bit of memory by making md_gil a bool. Variables that changed type are renamed, to detect conflicts.
* gh-141150: Don't rely on implicit conversion from void * to pointer in ↵Dino Viehland2025-11-061-1/+1
| | | | | _PyModule… (#141147) Don't rely on implicit conversion from void * to pointer in _PyModule_GetToken
* gh-140550: Initial implementation of PEP 793 – PyModExport (GH-140556)Petr Viktorin2025-11-051-8/+28
| | | | Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-132775: Add _PyModule_GetFilenameObject() and _PyModule_GetFilenameUTF8() ↵Eric Snow2025-04-281-0/+6
| | | | | | | (gh-132979) They are derived from the existing `PyModule_GetFilenameObject(). They are used by a later change related to pickle and handling __main__.
* gh-123930: Better error for "from imports" when script shadows module (#123929)Shantanu2024-10-241-0/+2
|
* gh-111178: Fix function signatures in moduleobject.c (#124900)Victor Stinner2024-10-021-1/+1
|
* gh-116322: Add Py_mod_gil module slot (#116882)Brett Simmers2024-05-031-0/+3
| | | | | | | | | | | | | | This PR adds the ability to enable the GIL if it was disabled at interpreter startup, and modifies the multi-phase module initialization path to enable the GIL when loading a module, unless that module's spec includes a slot indicating it can run safely without the GIL. PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148. A warning will be issued up to once per interpreter for the first GIL-using module that is loaded. If `-v` is given, a shorter message will be printed to stderr every time a GIL-using module is loaded (including the first one that issues a warning).
* gh-106320: Remove private _PyModule API (#107070)Victor Stinner2023-07-221-0/+6
| | | | | | | | | | | Move private _PyModule API to the internal C API (pycore_moduleobject.h): * _PyModule_Clear() * _PyModule_ClearDict() * _PyModuleSpec_IsInitializing() * _PyModule_IsExtension() No longer export these functions.
* gh-105927: finalize_modules_clear_weaklist() uses _PyWeakref_GET_REF() (#105971)Victor Stinner2023-06-211-1/+1
| | | | | finalize_modules_clear_weaklist() now holds a strong reference to the module longer than before: replace PyWeakref_GET_OBJECT() with _PyWeakref_GET_REF().
* gh-104066: Improve performance of hasattr for module objects (#104063)Itamar Ostricher2023-05-041-0/+3
|
* bpo-45459: Use type names in the internal C API (GH-31669)Victor Stinner2022-03-031-1/+1
| | | Replace "struct xxx" with "xxx" types in the internal C API.
* bpo-40137: Add pycore_moduleobject.h internal header (GH-25507)Victor Stinner2021-04-211-0/+42
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.