Skip to content

[3.11] gh-98724: Fix Py_CLEAR() macro side effects (#99100) - #99288

Merged
vstinner merged 1 commit into
python:3.11from
vstinner:py_clear311
Nov 9, 2022
Merged

vstinner merged 1 commit into
python:3.11from
vstinner:py_clear311

Conversation

@vstinner

@vstinner vstinner commented Nov 9, 2022 •

Copy link
Copy Markdown
Member

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 c03e05c)

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 c03e05c)
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@vstinner
vstinner deleted the py_clear311 branch November 9, 2022 15:29
@bedevere-bot

Copy link
Copy Markdown

GH-99292 is a backport of this pull request to the 3.10 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 9, 2022
…ythonGH-99288)

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)
vstinner added a commit that referenced this pull request Nov 18, 2022
vstinner added a commit that referenced this pull request Nov 21, 2022
…9100)" (#99573)

Revert "gh-98724: Fix Py_CLEAR() macro side effects (#99100) (#99288)"

This reverts commit 1082890.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants