summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-12-07 14:22:38 (GMT)
committerGitHub <noreply@github.com>2022-12-07 14:22:38 (GMT)
commitb11a384dc7471ffc16de4b86e8f5fdeef151f348 (patch)
treec2fc15ebb4de11991f9f1799fa2588a484003073 /Python
parent7031275776f43c76231318c2158a7a2753bc1fba (diff)
downloadcpython-b11a384dc7471ffc16de4b86e8f5fdeef151f348.zip
cpython-b11a384dc7471ffc16de4b86e8f5fdeef151f348.tar.gz
cpython-b11a384dc7471ffc16de4b86e8f5fdeef151f348.tar.bz2
gh-98724: Fix Py_CLEAR() macro side effects (#99100) (#100070)
The Py_CLEAR(), Py_SETREF() and Py_XSETREF() macros now only evaluate their arguments once. If an argument has side effects, these side effects are no longer duplicated. Use temporary variables to avoid duplicating side effects of macro arguments. If available, use _Py_TYPEOF() to avoid type punning. Otherwise, use memcpy() for the assignment to prevent a miscompilation with strict aliasing caused by type punning. Add _Py_TYPEOF() macro: __typeof__() on GCC and clang. Add test_py_clear() and test_py_setref() unit tests to _testcapi.
Diffstat (limited to 'Python')
0 files changed, 0 insertions, 0 deletions