summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_moduleobject.h
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] gh-123930: Better error for "from imports" when script shadows module ↵Shantanu2024-10-241-0/+2
| | | | | | | (GH-123929) (#125937) gh-123930: Better error for "from imports" when script shadows module (#123929) (cherry picked from commit 500f5338a8fe13719478589333fcd296e8e8eb02)
* 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.