Description
Bug report
Bug description:
Hi all,
We've just moved to 3.13 and I'm looking at the free-threaded interpreter stuff. We're embedding CPython in our own process and dynamically loading the shared library, so I can switch it to load the 3.13t library instead. However, we also have internally to the program some C modules that we expose into Python. These modules aren't separate .so files that get loaded in, they're part of the program which is then added with PyModule_Create2.
I obviously need to switch that to PyModuleDef_Init, but then I run into the problem that PyModuleDef_HEAD_INIT (via PyObject_HEAD_INIT) is defined differently in free threaded vs GIL mode. I would like to be able to compile the module once (or even have two code paths creating different objects), but currently that's impossible, since only one HEAD_INIT structure is defined at any given time.
I can make my module not rely on the GIL, but I'd like it to be able to load in both interpreter versions. Is this something that you are planning, or could plan, to support in future?
CPython versions tested on:
3.13
Operating systems tested on:
Linux