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:
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
See also:
Feature or enhancement
Proposal:
See PEP 793. I'll copy the abstract for reference:
PyInit_*(gh-140550: PEP 793 reference documentation #141197)DYNLOADFILEusers#141780)PyImport_AppendInittab& friendsPyMod_ExecinPyImport_CreateModuleFromInitfuncdocs is linked (gh-140550: PEP 793 reference documentation #141197)PyMODEXPORT_FUNCin blurb for#141672#141780xxlimited.cupdate (gh-140550: Update xxlimited with 3.15 limited API & PEP 697 #142827)_Py_OPAQUE_PYOBJECTinxxlimited.c(by 3.15.0 beta)Optional stretch goals:
PyInitfunction fromLib/test/test_cext/extension.c(gh-140550: Remove PyInit function from test_cext #141511)importdl: load the DLL onceboolfor the GIL flag (gh-140550: Use a bool for the Py_mod_gil value #141519)spec.nameinPyModule_FromSlotsAndSpecPy_mod_methodsPyModule_GetStateWithToken()functionHas this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
See also:
__declspec(dllexport)on Windows #141672