@@ -38,6 +38,17 @@ always available. Unless explicitly noted otherwise, all variables are read-only
3838 < python- input - 2 > :1 : DeprecationWarning : sys.abiflags will be set to a meaningful value on all platforms ...
3939 False
4040
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
49+ warnings.simplefilter(' ignore' , DeprecationWarning )
50+ abiflags = getattr (sys, ' abiflags' , ' ' )
51+
4152 Due to historical reasons, :data: `sys.abiflags ` is not covered by
4253 :pep: `3149 ` on Windows. Now we have multiple builds, such as the
4354 :term: `free-threaded <free threading> ` build, that provide different ABIs.
@@ -48,6 +59,18 @@ always available. Unless explicitly noted otherwise, all variables are read-only
4859 Windows in Python 3.16. This means the :data: `sys.abiflags ` member will
4960 always be available on all platforms starting from Python 3.16.
5061
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 in Python 3.14-3.15 |
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+ +---------------------------------------+---------------------------------------------------------------------+
5174
5275.. function :: addaudithook(hook)
5376
0 commit comments