FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-127405: Add `ABIFLAGS` to `sysconfig.get_config_vars()` on Windows by XuehaiPan · Pull Request #131799 · python/cpython · GitHub

/ cpython Public

gh-127405: Add ABIFLAGS to sysconfig.get_config_vars() on Windows - #131799

Merged
zooba merged 58 commits into
python:mainfrom
XuehaiPan:windows-add-sysconfig-abiflags
Apr 11, 2025
Merged

gh-127405: Add ABIFLAGS to sysconfig.get_config_vars() on Windows#131799
zooba merged 58 commits into
python:mainfrom
XuehaiPan:windows-add-sysconfig-abiflags

Conversation

XuehaiPan commented Mar 27, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

Set an upper-cased ABIFLAGS (previously not exist) to sysconfig.get_config_vars() on Windows.
The lower-cased abiflags in sysconfig.get_config_vars() remains an empty string on Windows.

See #127405 (comment).

Comment thread Lib/sysconfig/__init__.py Outdated
Comment thread Lib/sysconfig/__init__.py Outdated
Comment thread Lib/sysconfig/__init__.py Outdated
Comment thread Lib/sysconfig/__init__.py Outdated
XuehaiPan requested a review from zooba March 28, 2025 11:03
Comment thread Modules/_sysconfig.c Outdated
Comment thread Modules/_sysconfig.c Outdated
Comment on lines +58 to +74

// 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"
# endif
"")
< 0) {
Py_DECREF(config);
return NULL;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Instead of setting ABIFLAGS here, I'd prefer to add Py_DEBUG and then construct ABIFLAGS in sysconfig._init_non_posix.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Agree with adding Py_DEBUG, but if anything we should construct ABIFLAGS further back in the build (e.g. in a .props file) and store that value here.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

IMO, Py_DEBUG and Py_GIL_DISABLED should be in pyconfig.h, removing the need for a native module in the first place.

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, sysconfig._init_non_posix is the place I would expect them to be.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I do not have a strong preference for whether the code should live in Python or C. Both are fine for me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I do not have a strong preference for whether the code should live in Python or C. Both are fine for me.

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.

Comment thread Lib/sysconfig/__init__.py Outdated
XuehaiPan requested review from merwok and zooba April 8, 2025 16:58
Comment thread Lib/test/test_sysconfig.py Outdated
Comment thread Lib/sysconfig/__init__.py

merwok left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM – waiting for Steve’s approval

zooba left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nearly there! I just want to see that unspecified test clarified/removed, and we'll run it across all the platforms just to make sure the other test change is valid for them all.

Comment thread Lib/test/test_sysconfig.py Outdated
def test_abi_debug(self):
ABIFLAGS = sysconfig.get_config_var('ABIFLAGS')
if support.Py_DEBUG:
# The 'd' flag should always be the last one.

zooba Apr 11, 2025
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I still don't know if it's guaranteed.

Show me the definition of ABIFLAGS that specifies it (trick question - no such definition exists).

Let's not invent a specification in a barely-related PR. Make this a Windows-specific test that checks for _d at the end (or just check 'd' in ABIFLAGS), but don't touch other platforms.

Comment thread Lib/test/test_sysconfig.py Outdated
XuehaiPan requested a review from zooba April 11, 2025 11:21
zooba added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 11, 2025

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @zooba for commit d55b3e6 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F131799%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 11, 2025

zooba commented Apr 11, 2025

Copy link
Copy Markdown
Member

Looks like the buildbots were fine apart from the darwin ones, which has been fixed. So I'll merge it and we should keep an eye on any more failures (though I'm about to be AFK for the weekend and won't actually be watching... will look on Monday!)

zooba merged commit 26ae05e into python:main Apr 11, 2025

zooba commented Apr 11, 2025

Copy link
Copy Markdown
Member

Thanks for the contribution! And for bearing with me to make sure we get it right.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants


Back | FazBrowse Home | New Git URL