-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-127405: Emit a deprecation warning about a future change of sys.abiflags
availability on Windows
#131717
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
Open
XuehaiPan
wants to merge
61
commits into
python:main
Choose a base branch
from
XuehaiPan:windows-add-sys-abiflags
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
gh-127405: Emit a deprecation warning about a future change of sys.abiflags
availability on Windows
#131717
Changes from 47 commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
55c1c16
Emit a deprecation warning about a future change of `sys.abiflags` av…
XuehaiPan 198ee26
📜🤖 Added by blurb_it.
blurb-it[bot] 4a1ed1b
Update test regex
XuehaiPan 2ebe498
Merge branch 'main' into windows-add-sys-abiflags
XuehaiPan 6bc3d73
Remove unexpected new entry
XuehaiPan 85a8bae
ignore unused variable warning
XuehaiPan 5172fda
Set custom `sys.__getattr__`
XuehaiPan e2c0326
Catch warnings in stdlib
XuehaiPan 50a37fb
Catch warnings in stdlib
XuehaiPan 2236ed6
Add comments for `sys.__getattr__`
XuehaiPan 3467028
Catch warnings in stdlib
XuehaiPan 5b4f0eb
Merge branch 'main' into windows-add-sys-abiflags
XuehaiPan 143145f
Resolve leak reference on warning failure
XuehaiPan 0fd098f
Revert "Resolve leak reference on warning failure"
XuehaiPan abc1638
Add more tests
XuehaiPan 0a69992
Only add `sys.__getattr__` on Windows
XuehaiPan d49abc9
Update code examples in docs
XuehaiPan 8aa5556
Update code examples in docs
XuehaiPan 299c0d3
properly indent code
XuehaiPan 6c4bb07
Merge branch 'main' into windows-add-sys-abiflags
XuehaiPan 4503529
Revert "Only add `sys.__getattr__` on Windows"
XuehaiPan 437ba52
Extract common code into defs
XuehaiPan f20232a
Add migration guide in docs
XuehaiPan 5401970
Add blanklines
XuehaiPan 55160bf
Merge branch 'main' into windows-add-sys-abiflags
XuehaiPan 2eeac04
Add more details in warning message
XuehaiPan ac8005c
Add more details in warning message
XuehaiPan cfeaa3c
Merge branch 'main' into windows-add-sys-abiflags
XuehaiPan 65297cd
Resolve unused variable warning
XuehaiPan ba015a3
Merge branch 'main' into windows-add-sys-abiflags
XuehaiPan 4148d8c
Fix code indentation
XuehaiPan 78c0cab
Merge branch 'main' into windows-add-sys-abiflags
graingert 7e84118
Handle warnings in unittest marker
XuehaiPan 49f8d89
Clarify comments
XuehaiPan 56c7d91
Update docs
XuehaiPan 7884a62
Simplify `sys.abiflags` in `sysconfig` and `site`
XuehaiPan a5739ba
Simplify `sys.abiflags` in `sysconfig` and `site`
XuehaiPan 21ae49d
Revert "Simplify `sys.abiflags` in `sysconfig` and `site`"
XuehaiPan 74454ab
Revert "Simplify `sys.abiflags` in `sysconfig` and `site`"
XuehaiPan 45be11d
Simplify `sys.abiflags` in `site`
XuehaiPan 0864441
Merge branch 'main' into windows-add-sys-abiflags
XuehaiPan 1b8439b
Apply suggestions from code review
XuehaiPan bec62dc
Merge branch 'main' into windows-add-sys-abiflags
XuehaiPan 66c7b90
Resolve unused function warning
XuehaiPan 0d30914
Add todo comments around workarounds
XuehaiPan 659e573
Move migration guide to What's New docs
XuehaiPan 458ef7d
Apply suggestions from code review
XuehaiPan 2ff7082
Apply suggestions from code review
XuehaiPan 2e79345
Add a todo note in docs
XuehaiPan 36efb72
Add message regex in warning filters
XuehaiPan 25b299a
Merge branch 'main' into windows-add-sys-abiflags
XuehaiPan d23ab00
Merge branch 'main' into windows-add-sys-abiflags
XuehaiPan c8ec513
Add `sysconfig.get_config_vars` to what's new notes
XuehaiPan a4c575b
Fix auto merge commit
XuehaiPan 96b224d
Update tests
XuehaiPan 81ef28e
Merge branch 'main' into windows-add-sys-abiflags
XuehaiPan 1b634c4
Update todo comments
XuehaiPan 2381107
Merge branch 'main' into windows-add-sys-abiflags
XuehaiPan 958dd06
Merge branch 'main' into windows-add-sys-abiflags
XuehaiPan 5ad6305
Merge branch 'main' into windows-add-sys-abiflags
XuehaiPan 9b7d586
Merge branch 'main' into windows-add-sys-abiflags
XuehaiPan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -325,6 +325,7 @@ def get_default_scheme(): | |
|
||
def get_makefile_filename(): | ||
"""Return the path of the Makefile.""" | ||
import warnings | ||
|
||
# GH-127429: When cross-compiling, use the Makefile from the target, instead of the host Python. | ||
if cross_base := os.environ.get('_PYTHON_PROJECT_BASE'): | ||
|
@@ -333,7 +334,14 @@ def get_makefile_filename(): | |
if _PYTHON_BUILD: | ||
return os.path.join(_PROJECT_BASE, "Makefile") | ||
|
||
if hasattr(sys, 'abiflags'): | ||
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. Are there any details about the existence of hasattr(sys, 'abiflags')
os.name == 'nt' # os.name != 'posix'
not sys.platform.startswith('win') |
||
# XXX: Remove this in Python 3.16 | ||
# This flag will always be True since Python 3.16 | ||
with warnings.catch_warnings(): | ||
# ignore DeprecationWarning on sys.abiflags change on Windows | ||
warnings.simplefilter('ignore', DeprecationWarning) | ||
has_abiflags = hasattr(sys, 'abiflags') | ||
|
||
if has_abiflags: | ||
config_dir_name = f'config-{_PY_VERSION_SHORT}{sys.abiflags}' | ||
else: | ||
config_dir_name = 'config' | ||
|
@@ -496,6 +504,8 @@ def get_path(name, scheme=get_default_scheme(), vars=None, expand=True): | |
|
||
|
||
def _init_config_vars(): | ||
import warnings | ||
|
||
global _CONFIG_VARS | ||
_CONFIG_VARS = {} | ||
|
||
|
@@ -504,10 +514,12 @@ def _init_config_vars(): | |
base_prefix = _BASE_PREFIX | ||
base_exec_prefix = _BASE_EXEC_PREFIX | ||
|
||
try: | ||
abiflags = sys.abiflags | ||
except AttributeError: | ||
abiflags = '' | ||
# XXX: Remove this context manager in Python 3.16 | ||
# sys.abiflags will always be available on all platforms since Python 3.16 | ||
with warnings.catch_warnings(): | ||
# ignore DeprecationWarning on sys.abiflags change on Windows | ||
XuehaiPan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
warnings.simplefilter('ignore', DeprecationWarning) | ||
abiflags = getattr(sys, 'abiflags', '') | ||
|
||
if os.name == 'posix': | ||
_init_posix(_CONFIG_VARS) | ||
|
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
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
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
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
1 change: 1 addition & 0 deletions
1
Misc/NEWS.d/next/Core_and_Builtins/2025-03-25-13-32-18.gh-issue-127405.o10vve.rst
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Emit a :exc:`DeprecationWarning` about a future change of :data:`sys.abiflags` availability on Windows. Patch by Xuehai Pan. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.