I’m trying to help someone who was trying to build a really basic Cython extension module with the free-threading build on Windows. I think it’s going to hit anyone trying to build an extension module on Windows and not just Cython.
Essentially 3 things go wrong:
the installer generates 2 exes, but only one pyconfig.h file (which is for the regular non-freethreading build). This means that when you run python3.13t.exe setup.py build_ext --inplace it actually builds without Py_GIL_DISABLED set.
However it still generates an extension file: something.cp313t-win_amd64.pyd which is misleadingly named as if it is a correct free-threading extension module. Which then immediately crashes.
If I manually edit pyconfig.h to uncomment #define Py_GIL_DISABLED 1 when I get a different error: LINK : fatal error LNK1104: cannot open file 'python313t.lib'. That lib file doesn’t appear to be part of the Windows distribution, and that’s when I get stuck.
Apologies if this is posted in the wrong place - I’m not sure where’s the best place for installer bugs. Happy to file this as a bug report somewhere else if that’s more appropriate.
You should be able to define this yourself when building (hopefully your build backend allows for preprocessor variables). The multiple pyconfig.h problem is why we skipped an alpha, and this is the workaround, which will probably last until the day when the variable becomes redundant.
It looks like you’re using setuptools. They can start detecting the variable and passing it themselves whenever they like. Unlike the change to having multiple pyconfig.h files, we didn’t feel the need to block releases until they caught up. It’s easy enough to set the variable yourself.
That’s a bug, if you’ve selected the option for the freethreaded binaries. It should include the right libs.
with latest python-3.13.0b2 (python.org download, windows), I get a fib.cp313t-win_amd64.pyd, but “import fib” still exits miserably … a procedure would be appreciated, if you can build one
Py_GIL_DISABLED isn’t defined. This is apparently difficult to fix in the Windows distribution and I don’t think a fix is planned. You need to define that macro yourself (e.g. in your setup.py script).
The missing library. That has been fixed (but I’m not sure if for beta 2).
If you’re getting a crash then you’re hitting issue 1 so solve that first.