A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/python/cpython/issues/116936 below:

Add PyType_GetModuleByDef() to the limited C API version 3.13 · Issue #116936 · python/cpython · GitHub

I propose adding PyType_GetModuleByDef() to the limited C API version 3.13. The function was added to Python 3.9, the function is now well tested. We could add it way earlier to the limited C API.

cc @encukou

The PyType_GetModuleByDef() function is needed to access the module state in C function which don't get a module as first parameter, but only an instance of a heap type. Heap types should be created with PyType_FromModuleAndSpec(module, spec, bases) to store the module in the type. PyType_GetModuleByDef(type) gives the module and then PyModule_GetState() gives the moulde state.

Examples of functions which don't get a module argument:

Without PyType_GetModuleByDef(), many static types cannot be converted to heap types.

The following stdlib extensions use PyType_GetModuleByDef()

Modules/_asynciomodule.c
Modules/_bz2module.c
Modules/_collectionsmodule.c
Modules/_csv.c
Modules/_decimal/_decimal.c
Modules/_elementtree.c
Modules/_functoolsmodule.c
Modules/_io/_iomodule.h
Modules/_pickle.c
Modules/_queuemodule.c
Modules/_randommodule.c
Modules/_sqlite/module.h
Modules/_ssl.c
Modules/_ssl.h
Modules/_struct.c
Modules/_testmultiphase.c
Modules/_threadmodule.c
Modules/_xxinterpchannelsmodule.c
Modules/_zoneinfo.c
Modules/arraymodule.c
Modules/cjkcodecs/multibytecodec.c
Modules/clinic/_testmultiphase.c.h
Modules/itertoolsmodule.c
Modules/socketmodule.c
Python/Python-tokenize.c
Linked PRs

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4