Feature or enhancement
Proposal:
See PEP 793. I'll copy the abstract for reference:
In this PEP, we propose a new entry point for C extension modules, by which one can define a module using an array of PyModuleDef_Slot structures without an enclosing PyModuleDef structure. This allows extension authors to avoid using a statically allocated PyObject, lifting the most common obstacle to making one compiled library file usable with both regular and free-threaded builds of CPython.
To make this viable, we also specify new module slot types to replace PyModuleDef’s fields, and to allow adding a token similar to the Py_tp_token used for type objects.
We also add an API for defining modules from slots dynamically.
The existing API (PyInit_*) is soft-deprecated. (That is: it will continue to work without warnings, and it’ll be fully documented and supported, but we plan to not add any new features to it.)
Optional stretch goals:
- Remove the PyInit function from Lib/test/test_cext/extension.c (gh-140550: Remove PyInit function from test_cext #141511)
- Speed & size improvements
- No longer require spec.name in PyModule_FromSlotsAndSpec
- No longer require static allocation for Py_mod_methods
- Add a PyModule_GetStateWithToken() function
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
See also:
Reactions are currently unavailable
Feature or enhancement
Proposal:
See PEP 793. I'll copy the abstract for reference:
Optional stretch goals:
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
See also: