@@ -25,52 +25,14 @@ always available. Unless explicitly noted otherwise, all variables are read-only
2525 .. availability :: Unix.
2626
2727 .. versionchanged :: next
28- A deprecation warning will be emitted if the :data: `sys.abiflags ` member
29- is accessed on Windows before Python 3.16.
30- For example:
31-
32- .. code-block :: python
33-
34- >> > import sys
35- >> > getattr (sys, ' abiflags' , None ) # on Windows
36- < python- input - 1 > :1 : DeprecationWarning : sys.abiflags will be set to a meaningful value on all platforms ...
37- >> > hasattr (sys, ' abiflags' ) # on Windows
38- < python- input - 2 > :1 : DeprecationWarning : sys.abiflags will be set to a meaningful value on all platforms ...
39- False
40-
41- To suppress this warning, use the :mod: `warnings ` module:
42-
43- .. code-block :: python
44-
45- import warnings
46-
47- with warnings.catch_warnings():
48- # ignore DeprecationWarning on sys.abiflags change on Windows
49- warnings.simplefilter(' ignore' , DeprecationWarning )
50- abiflags = getattr (sys, ' abiflags' , ' ' )
51-
52- Due to historical reasons, :data: `sys.abiflags ` is not covered by
53- :pep: `3149 ` on Windows. Now we have multiple builds, such as the
54- :term: `free-threaded <free threading> ` build, that provide different ABIs.
55- :data: `sys.abiflags ` is now required under many circumstances to determine
56- the ABI of the Python interpreter.
57-
58- The :data: `sys.abiflags ` member will be set to a meaningful value on
59- Windows in Python 3.16. This means the :data: `sys.abiflags ` member will
60- always be available on all platforms starting from Python 3.16.
61-
62- The following table shows how to migrate from the old code to the new code
63- without changing the behavior:
64-
65- +---------------------------------------+---------------------------------------------------------------------+
66- | Code prior to Python 3.14 | Code prior to Python 3.16 with the same behavior |
67- +=======================================+=====================================================================+
68- | ``sys.abiflags `` | ``sys.abiflags `` |
69- +---------------------------------------+---------------------------------------------------------------------+
70- | ``getattr(sys, 'abiflags', default) `` | ``sys.abiflags if not sys.platform.startswith('win') else default `` |
71- +---------------------------------------+---------------------------------------------------------------------+
72- | ``hasattr(sys, 'abiflags') `` | ``not sys.platform.startswith('win') `` |
73- +---------------------------------------+---------------------------------------------------------------------+
28+ A :exc: `DeprecationWarning ` will be emitted if the :data: `sys.abiflags `
29+ member is accessed on Windows before Python 3.16. The :data: `sys.abiflags `
30+ member will be set to a meaningful value on Windows in Python 3.16. This
31+ means the :data: `sys.abiflags ` member will always be available on all
32+ platforms starting from Python 3.16.
33+
34+ See :ref: `whatsnew314-sys-abiflags-change ` in the *What's New * for more
35+ details.
7436
7537
7638.. function :: addaudithook(hook)
0 commit comments