-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
BUG: Fix a MacOS build failure #17906
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
Conversation
Is it supposed to do this? This seems like an accidental breaking change in python that may need addressing upstream. |
See python/cpython#23556 and https://bugs.python.org/issue42504 |
Just wanted to +1 this, as I've just run into this myself. |
Although as you point out the intent may have been clear when reading the code, it was not clear to CPython devs (hence the need for a fix in other places in the code) nor to anyone else using sysconfig (like us), nor is it documented behaviour. This seems like one bad API choice following another. |
From the documentation you link:
It is clear that int-type values are returned as int. |
I quickly tried it out on a 10.14.6 (Mojave) MBP and got the following results: >>> sysconfig.get_config_var('Py_ENABLE_SHARED')
0
>>> sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
'10.14' So at some point it did return a string. I get |
It returns an int when the value is exactly representable as an int, and a string otherwise. |
@fxcoudert I would not call that documented behaviour. The documentation should clearly state that the function will try to return an int and if it fails, a str. @luketaverne |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The discussion is interesting but shouldn't affect the proposed change in this PR, the one liner fix is correct and unbreaks the build for some macOS 11 users, so let's get this in. Thanks @fxcoudert, all.
@rgommers I see this didn't make it into the 1.19.5 version (Homebrew/homebrew-core#68346), shouldn't this simple patch be backported? |
Argh yes, that is an oversight. I should have put on a label, then @charris would have seen it when deciding what to backport for 1.19.5. Done now; luckily |
The milestone needed to be 1.19.5. NumPy 1.20.0 is waiting for pyarrow to release. If they don't get a move on I'll release anyway. |
I'm not planning on another 1.19 release. |
numpy
fails to build on macOS Big Sur, on a Python 3.9.0 that was configured withMACOSX_DEPLOYMENT_TARGET=11
:On such a system,
sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
will return11
as anint
, not as astr
. And setting an environment variable to anint
is not allowed, and fails as seen above.