summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew/3.12.rst
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-11-09 13:06:36 (GMT)
committerGitHub <noreply@github.com>2022-11-09 13:06:36 (GMT)
commitc03e05c2e72f3ea5e797389e7d1042eef85ad37a (patch)
tree3a30ddb1b3b35a9b2ea7d233f242c72e74e71e71 /Doc/whatsnew/3.12.rst
parent0124b5dd28eff7bb80eb7244e97e402a036db13b (diff)
downloadcpython-c03e05c2e72f3ea5e797389e7d1042eef85ad37a.zip
cpython-c03e05c2e72f3ea5e797389e7d1042eef85ad37a.tar.gz
cpython-c03e05c2e72f3ea5e797389e7d1042eef85ad37a.tar.bz2
gh-98724: Fix Py_CLEAR() macro side effects (#99100)
The Py_CLEAR(), Py_SETREF() and Py_XSETREF() macros now only evaluate their argument once. If an argument has side effects, these side effects are no longer duplicated. Add test_py_clear() and test_py_setref() unit tests to _testcapi.
Diffstat (limited to 'Doc/whatsnew/3.12.rst')
-rw-r--r--Doc/whatsnew/3.12.rst5
1 files changed, 5 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst
index 7ebfc55..37b9fb1 100644
--- a/Doc/whatsnew/3.12.rst
+++ b/Doc/whatsnew/3.12.rst
@@ -792,6 +792,11 @@ Porting to Python 3.12
:class:`bytes` type is accepted for bytes strings.
(Contributed by Victor Stinner in :gh:`98393`.)
+* The :c:macro:`Py_CLEAR`, :c:macro:`Py_SETREF` and :c:macro:`Py_XSETREF`
+ macros now only evaluate their argument once. If the argument has side
+ effects, these side effects are no longer duplicated.
+ (Contributed by Victor Stinner in :gh:`98724`.)
+
Deprecated
----------