-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
base: main
Are you sure you want to change the base?
gh-127405: Emit a deprecation warning about a future change of sys.abiflags
availability on Windows
#131717
Changes from all commits
55c1c16
198ee26
4a1ed1b
2ebe498
6bc3d73
85a8bae
5172fda
e2c0326
50a37fb
2236ed6
3467028
5b4f0eb
143145f
0fd098f
abc1638
0a69992
d49abc9
8aa5556
299c0d3
6c4bb07
4503529
437ba52
f20232a
5401970
55160bf
2eeac04
ac8005c
cfeaa3c
65297cd
ba015a3
4148d8c
78c0cab
7e84118
49f8d89
56c7d91
7884a62
a5739ba
21ae49d
74454ab
45be11d
0864441
1b8439b
bec62dc
66c7b90
0d30914
659e573
458ef7d
2ff7082
2e79345
36efb72
25b299a
d23ab00
c8ec513
a4c575b
96b224d
81ef28e
1b634c4
2381107
958dd06
5ad6305
9b7d586
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 |
---|---|---|
|
@@ -24,6 +24,22 @@ always available. Unless explicitly noted otherwise, all variables are read-only | |
|
||
.. availability:: Unix. | ||
|
||
.. versionchanged:: next | ||
A :exc:`DeprecationWarning` will be emitted if the :data:`sys.abiflags` | ||
member is accessed on Windows before Python 3.16. The :data:`!sys.abiflags` | ||
member will be set to a meaningful value on Windows in Python 3.16. This | ||
means the :data:`!sys.abiflags` member will always be available on all | ||
platforms starting from Python 3.16. | ||
|
||
See the notes for :ref:`incoming change to sys.abiflags | ||
<whatsnew314-sys-abiflags-change>` on the *What's New in 3.14* | ||
page for more details. | ||
Comment on lines
+34
to
+36
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. The first beta version of Python 3.14 is out. Any comment on this? |
||
|
||
.. TODO: When we're in Python 3.16: | ||
- Add a **CAUTION** section about the differences of :data:`sys.abiflags` | ||
between prior-3.14, 3.14-3.15, and 3.16+ on Windows. | ||
- Move porting recommendations from whatsnew/3.14.rst. | ||
|
||
XuehaiPan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.. function:: addaudithook(hook) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -314,6 +314,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'): | ||
|
@@ -322,7 +323,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') |
||
# TODO: 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.filterwarnings('ignore', r'sys\.abiflags', category=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) | ||
|
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. |
Uh oh!
There was an error while loading. Please reload this page.