-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
gh-127405: Add ABIFLAGS
to sysconfig.get_config_vars()
on Windows
#131799
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
Changes from 7 commits
31b7eab
dc45897
9a4586a
76c85bb
b98419b
4729f76
04cbb1c
a6045ea
584e0b0
93257be
30c7b56
97942b2
917874c
f49067e
8fa952b
08d92db
b667dd9
30cf6c7
5df9540
018aae3
4f22ff3
f918241
a4646c5
7b21d7d
1ee8230
084deac
af50632
b397f40
1a82cd1
7990798
0744690
518137b
486e2a8
3bccf1d
780f340
98c26f9
e236bc7
0d8bcdd
278556c
5689c1f
299cec6
21d2e73
d265a59
f3b8570
fe4ea95
da2b4ce
64f0961
8b16454
1c807f0
fbb86f5
b702ff9
932386c
23b6e6c
75b6c51
3c91201
d55b3e6
a084070
d2255e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add ``ABIFLAGS`` to :func:`sysconfig.get_config_vars` on Windows. Patch by Xuehai Pan. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,23 @@ _sysconfig_config_vars_impl(PyObject *module) | |
Py_DECREF(config); | ||
return NULL; | ||
} | ||
|
||
// On Unix, the `ABIFLAGS` key is defined via a different logic. | ||
// | ||
// Emulate `sys.abiflags` value on Unix for Windows. ABIFLAGS here is only | ||
// an emulated value. It is not present during build on Windows. | ||
if (add_string_value(config, "ABIFLAGS", | ||
# ifdef Py_GIL_DISABLED | ||
"t" | ||
# endif | ||
# ifdef _DEBUG | ||
"d" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think making this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Can't we use something like this? def add_underscore_d(x):
if os.name == 'nt':
return x.replace('d', '_d')
return x
executable = f'python{version}{add_underscore_d(ABIFLAGS)}.exe' Explicit is better than implicit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It isn't "we" - it's "every single user ever for the rest of time". Our job as core maintainers is to do more work and make less obvious decisions so that every single user doesn't have to. Don't bother quoting the zen at me either. "Special cases aren't special enough" applies just as well here, as does "one obvious way" (which is to use If you want to run with the "explicit > implicit" argument, here's a more explicit version:
Inserting an underscore is neither explicit, nor obvious, and is definitely a special case that isn't special enough to not just use a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added the underscore prefix in the Python code so that developers can introspect the source more easily. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A constraint of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Users can't split up the value anyway, that's not what it's for. You can parse it specifically, which basically amounts to an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I still don't understand why this definition needs to be in the native module, instead of generating it in the Python code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally, as you say, all these variables should be defined in On Windows, we don't parse If not set in So basically, tier 2 is closer to ideal than tier 3 would be, and importantly it makes it clearer that this is exposing an internally defined value, rather than trying to adhere to some kind of definition of what Footnotes
|
||
# endif | ||
"") | ||
< 0) { | ||
Py_DECREF(config); | ||
return NULL; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of setting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree with adding We don't need or use it, though, so I don't see an issue with constructing it here. But I'd rather have build variables be closer to the build rather than further away. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO, But ignoring that, I think it would be more maintainable to have all variables that need construction in the same place. Having part of them here, and part of them in the Python module should be avoidable if we can. Especially for Windows specific variables emulating POSIX ones, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not have a strong preference for whether the code should live in Python or C. Both are fine for me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I move the definition from C to Python in the latest commit. I can either keep it or revert it if we reach a consensus. |
||
#endif | ||
|
||
#ifdef Py_GIL_DISABLED | ||
|
Uh oh!
There was an error while loading. Please reload this page.