diff options
author | Victor Stinner <vstinner@python.org> | 2022-11-09 13:06:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-09 13:06:36 (GMT) |
commit | c03e05c2e72f3ea5e797389e7d1042eef85ad37a (patch) | |
tree | 3a30ddb1b3b35a9b2ea7d233f242c72e74e71e71 /Misc | |
parent | 0124b5dd28eff7bb80eb7244e97e402a036db13b (diff) | |
download | cpython-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 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/C API/2022-11-04-16-13-35.gh-issue-98724.p0urWO.rst | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/C API/2022-11-04-16-13-35.gh-issue-98724.p0urWO.rst b/Misc/NEWS.d/next/C API/2022-11-04-16-13-35.gh-issue-98724.p0urWO.rst new file mode 100644 index 0000000..2613b17 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2022-11-04-16-13-35.gh-issue-98724.p0urWO.rst @@ -0,0 +1,3 @@ +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. Patch by Victor Stinner. |