[3.10] gh-98724: Fix Py_CLEAR() macro side effects (GH-99100) (GH-99288) by miss-islington · Pull Request #99292 · python/cpython (original) (raw)
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.
(cherry picked from commit 1082890)
Co-authored-by: Victor Stinner vstinner@python.org
(cherry picked from commit c03e05c)