Skip to content

Commit 2ff7082

Browse files
committed
Apply suggestions from code review
1 parent 458ef7d commit 2ff7082

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

Doc/library/sys.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ always available. Unless explicitly noted otherwise, all variables are read-only
2626

2727
.. versionchanged:: next
2828
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`
29+
member is accessed on Windows before Python 3.16. The :data:`!sys.abiflags`
3030
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
31+
means the :data:`!sys.abiflags` member will always be available on all
3232
platforms starting from Python 3.16.
3333

34-
See the notes for :ref:`incoming change to sys.abiflags <whatsnew314-sys-abiflags-change>`
35-
in the *What's New* for more details.
34+
See the notes for :ref:`incoming change to sys.abiflags
35+
<whatsnew314-sys-abiflags-change>` on the *What's New in 3.14*
36+
page for more details.
3637

3738

3839
.. function:: addaudithook(hook)

Doc/whatsnew/3.14.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -930,10 +930,11 @@ sys
930930
It is always ``'freebsd'``, instead of ``'freebsd13'`` or ``'freebsd14'``.
931931

932932
* Schedule a change for availability of :data:`sys.abiflags` on Windows. A
933-
:exc:`DeprecationWarning` will be emitted if the :data:`sys.abiflags` member
933+
:exc:`DeprecationWarning` will be emitted if the :data:`!sys.abiflags` member
934934
is accessed on Windows before Python 3.16.
935935
(Contributed by Xuehai Pan in :gh:`131717`.)
936936

937+
937938
.. _whatsnew314-sys-abiflags-change:
938939

939940
sys.abiflags
@@ -966,11 +967,11 @@ To suppress this warning, use the :mod:`warnings` module:
966967
Due to historical reasons, :data:`sys.abiflags` is not covered by
967968
:pep:`3149` on Windows. Now we have multiple builds, such as the
968969
:term:`free-threaded <free threading>` build, that provide different ABIs.
969-
:data:`sys.abiflags` is now required under many circumstances to determine
970+
:data:`!sys.abiflags` is now required under many circumstances to determine
970971
the ABI of the Python interpreter.
971972

972-
The :data:`sys.abiflags` member will be set to a meaningful value on
973-
Windows in Python 3.16. This means the :data:`sys.abiflags` member will
973+
The :data:`!sys.abiflags` member will be set to a meaningful value on
974+
Windows in Python 3.16. This means the :data:`!sys.abiflags` member will
974975
always be available on all platforms starting from Python 3.16.
975976

976977
The following table shows how to migrate from the old code to the new code
@@ -986,6 +987,7 @@ without changing the behavior:
986987
| ``hasattr(sys, 'abiflags')`` | ``not sys.platform.startswith('win')`` |
987988
+---------------------------------------+---------------------------------------------------------------------+
988989

990+
989991
sys.monitoring
990992
--------------
991993

Python/sysmodule.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ _PySys_GetRequiredAttr(PyObject *name)
113113
#ifndef ABIFLAGS
114114
if (_PyUnicode_EqualToASCIIString(name, "abiflags")) {
115115
if (_warn_incoming_sys_abiflags_change() < 0) {
116-
Py_XDECREF(value);
116+
Py_CLEAR(value);
117117
return NULL;
118118
}
119119
}
@@ -137,7 +137,7 @@ _PySys_GetRequiredAttrString(const char *name)
137137
#ifndef ABIFLAGS
138138
if (strcmp(name, "abiflags") == 0) {
139139
if (_warn_incoming_sys_abiflags_change() < 0) {
140-
Py_XDECREF(value);
140+
Py_CLEAR(value);
141141
return NULL;
142142
}
143143
}
@@ -217,6 +217,7 @@ PySys_GetObject(const char *name)
217217
#ifndef ABIFLAGS
218218
if (ret == 0 && strcmp(name, "abiflags") == 0) {
219219
if (_warn_incoming_sys_abiflags_change() < 0) {
220+
Py_CLEAR(value);
220221
return NULL;
221222
}
222223
}

0 commit comments

Comments
 (0)