-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 3.13a4 ships with wrong pyconfig.h? #115582
Comments
I'm guessing these might both have the same root cause, but cc @zooba |
Yeah, entirely possible that things have gotten mixed up. I already have #115545 which is going to be the same root cause. |
So fundamentally the problem is that I tried to share the I'm most tempted to just drop the free-threaded binaries from the installer and only release them as a zip (essentially, the Nuget package, but a bit more discoverable). The alternatives are to:
The only one of those I kind of like is 3, but I suspect we'll run into more and more issues with trying to keep them together, and just splitting it out into a totally separate package is going to be safest. I'm thinking out loud right now - going to sleep on it before making a decision, so if anyone has thoughts, please speak up! |
For reference/prior art: Fedora uses the same include directory for 64-bit and 32-bit builds.
Ubuntu takes the idea much further -- for all architectures. pyconfig.h from an Ubuntu container# cat /usr/include/python3.10/pyconfig.h
#if defined(__linux__)
# if defined(__x86_64__) && defined(__LP64__)
# include <x86_64-linux-gnu/python3.10/pyconfig.h>
# elif defined(__x86_64__) && defined(__ILP32__)
# include <x86_64-linux-gnux32/python3.10/pyconfig.h>
# elif defined(__i386__)
# include <i386-linux-gnu/python3.10/pyconfig.h>
# elif defined(__aarch64__) && defined(__AARCH64EL__)
# include <aarch64-linux-gnu/python3.10/pyconfig.h>
# elif defined(__arc__)
# include <arc-linux-gnu/python3.10/pyconfig.h>
# elif defined(__alpha__)
# include <alpha-linux-gnu/python3.10/pyconfig.h>
# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP)
# include <arm-linux-gnueabihf/python3.10/pyconfig.h>
# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
# include <arm-linux-gnueabi/python3.10/pyconfig.h>
# elif defined(__hppa__)
# include <hppa-linux-gnu/python3.10/pyconfig.h>
# elif defined(__ia64__)
# include <ia64-linux-gnu/python3.10/pyconfig.h>
# elif defined(__m68k__) && !defined(__mcoldfire__)
# include <m68k-linux-gnu/python3.10/pyconfig.h>
# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) && defined(_MIPSEL)
# if _MIPS_SIM == _ABIO32
# include <mipsisa32r6el-linux-gnu/python3.10/pyconfig.h>
# elif _MIPS_SIM == _ABIN32
# include <mipsisa64r6el-linux-gnuabin32/python3.10/pyconfig.h>
# elif _MIPS_SIM == _ABI64
# include <mipsisa64r6el-linux-gnuabi64/python3.10/pyconfig.h>
# else
# error unknown multiarch location for pyconfig.h
# endif
# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6)
# if _MIPS_SIM == _ABIO32
# include <mipsisa32r6-linux-gnu/python3.10/pyconfig.h>
# elif _MIPS_SIM == _ABIN32
# include <mipsisa64r6-linux-gnuabin32/python3.10/pyconfig.h>
# elif _MIPS_SIM == _ABI64
# include <mipsisa64r6-linux-gnuabi64/python3.10/pyconfig.h>
# else
# error unknown multiarch location for pyconfig.h
# endif
# elif defined(__mips_hard_float) && defined(_MIPSEL)
# if _MIPS_SIM == _ABIO32
# include <mipsel-linux-gnu/python3.10/pyconfig.h>
# elif _MIPS_SIM == _ABIN32
# include <mips64el-linux-gnuabin32/python3.10/pyconfig.h>
# elif _MIPS_SIM == _ABI64
# include <mips64el-linux-gnuabi64/python3.10/pyconfig.h>
# else
# error unknown multiarch location for pyconfig.h
# endif
# elif defined(__mips_hard_float)
# if _MIPS_SIM == _ABIO32
# include <mips-linux-gnu/python3.10/pyconfig.h>
# elif _MIPS_SIM == _ABIN32
# include <mips64-linux-gnuabin32/python3.10/pyconfig.h>
# elif _MIPS_SIM == _ABI64
# include <mips64-linux-gnuabi64/python3.10/pyconfig.h>
# else
# error unknown multiarch location for pyconfig.h
# endif
# elif defined(__or1k__)
# include <or1k-linux-gnu/python3.10/pyconfig.h>
# elif defined(__powerpc__) && defined(__SPE__)
# include <powerpc-linux-gnuspe/python3.10/pyconfig.h>
# elif defined(__powerpc64__)
# if defined(__LITTLE_ENDIAN__)
# include <powerpc64le-linux-gnu/python3.10/pyconfig.h>
# else
# include <powerpc64-linux-gnu/python3.10/pyconfig.h>
# endif
# elif defined(__powerpc__)
# include <powerpc-linux-gnu/python3.10/pyconfig.h>
# elif defined(__s390x__)
# include <s390x-linux-gnu/python3.10/pyconfig.h>
# elif defined(__s390__)
# include <s390-linux-gnu/python3.10/pyconfig.h>
# elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
# include <sh4-linux-gnu/python3.10/pyconfig.h>
# elif defined(__sparc__) && defined(__arch64__)
# include <sparc64-linux-gnu/python3.10/pyconfig.h>
# elif defined(__sparc__)
# include <sparc-linux-gnu/python3.10/pyconfig.h>
# elif defined(__riscv)
# if __riscv_xlen == 64
# include <riscv64-linux-gnu/python3.10/pyconfig.h>
# else
# include <riscv32-linux-gnu/python3.10/pyconfig.h>
# endif
# else
# error unknown multiarch location for pyconfig.h
# endif
#elif defined(__FreeBSD_kernel__)
# if defined(__LP64__)
# include <x86_64-kfreebsd-gnu/python3.10/pyconfig.h>
# elif defined(__i386__)
# include <i386-kfreebsd-gnu/python3.10/pyconfig.h>
# else
# error unknown multiarch location for pyconfig.h
# endif
#elif defined(__gnu_hurd__)
# include <i386-gnu/python3.10/pyconfig.h>
#else
# error unknown multiarch location for pyconfig.h
#endif Of course, free-threaded builds depend on |
Yeah, Windows also uses the same Include directory (including pyconfig.h) for all platforms. This is the first CPython build option other than debug ( I believe everything in the headers is already based on And defining it in your extension doesn't actually disable the GIL, it just says that your extension requires a build of Python that has it defined, which very much implies that you should be able to get it from somewhere. We have no precedent of a The simplest immediate fix would be to make sure that defining |
The simplest immediate fix does sound fine for experimentation. AFAIK, in 3.13, building extensions for free-threaded builds won't be a smooth experience in general; it's OK to just make it possible. I can see |
So then the question we have is whether our header files should be agnostic towards Alternatively, if
Or do we just allow "upgrading" (we won't undef it, so if you def it then you get it). |
I lean toward only allowing “upgrading”. When the experiment is done, “downgrading” will stop working; we probably don't want |
There are two main concerns with this:
I'm not sure what's needed for the make build, but I can easily remove the undef from the default Windows headers. |
…ilds with manual /DPy_GIL_DISABLED
…ith manual /DPy_GIL_DISABLED (GH-115850)
The fix to our release build will ensure that the non-freethreaded header is shipped next time, and #115850 will allow people to override the variable if they want to build for freethreaded. That's the best we can do right now, and it at least unblocks the use of 3.13. Once build backends start figuring out how they want to be doing freethreaded builds we can look at ways to make it smoother to select the right setting. Or if having the builds install together becomes more of a pain than the length of the downloads list, we might switch it to its own parallel install and then the default header will be fine. |
…ilds with manual /DPy_GIL_DISABLED (pythonGH-115850)
…ilds with manual /DPy_GIL_DISABLED (pythonGH-115850)
…ilds with manual /DPy_GIL_DISABLED (pythonGH-115850)
…ilds with manual /DPy_GIL_DISABLED (pythonGH-115850)
Bug report
Bug description:
Hello,
I tried to build a C-extension locally with python 3.13a4 and got the error
LINK : fatal error LNK1104: cannot open file 'python313t.lib'
.(I got Python 3.13a4 from the python.org installer, tested Windows 32 and 64 bit).
After trying to install the free threaded builds using the new installer option, trying to build using those, and then installing everything fresh, I found that in
include/pyconfig.h
, there is a line#define Py_GIL_DISABLED 1
. This line causes the compiler to look for python313t.lib instead of python313.lib, and commenting it out fixed the build.It seems to me that the non-freethreaded build is shipping out with the wrong pyconfig.h setup.
This was reported by Pillow here: python-pillow/Pillow#7805
They linked it to #115545, but I think that may be a different issue? The interpreters launch fine from the python.org install, they just don't seem to work for building C-extensions with.
Thank you.
CPython versions tested on:
3.13
Operating systems tested on:
Windows
Linked PRs
The text was updated successfully, but these errors were encountered: