FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.15] gh-157649: Fix Py_CLEAR()/Py_SETREF() on C++ by vstinner · Pull Request #159143 · python/cpython · GitHub

Repository navigation

[3.15] gh-157649: Fix Py_CLEAR()/Py_SETREF() on C++ - #159143

Merged
vstinner merged 2 commits into
python:3.15from
vstinner:clear15
Oct 10, 2026
Merged

vstinner merged 2 commits into
python:3.15from
vstinner:clear15

Conversation

vstinner commented Oct 10, 2026 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

Using MSVC (on Windows), _Py_TYPEOF() prefers decltype()
over __typeof__() on C++.

Fix also _Py_TYPEOF() usage in Py_CLEAR() and Py_SETREF() macros.
Replace "_Py_TYPEOF(dst)*" with "_Py_TYPEOF(&(dst))". In C++,
"_Py_TYPEOF(dst)*" can fail with a compiler error.

(cherry picked from commit bba99f2)
On C++, do not use decltype() in _Py_TYPEOF since it produces invalid
code in Py_CLEAR() and Py_SETREF(). Instead, implement Py_CLEAR(),
Py_SETREF() and Py_XSETREF() using "auto" on C++11 and newer.

Add Py_CLEAR(), Py_SETREF() and Py_XSETREF() tests on an array.

(cherry picked from commit 3330712)

Copy link
Copy Markdown
Member Author

Note to myself: the changes should be backported to 3.14 including #157186.

vstinner merged commit 7ba9a77 into python:3.15 Oct 10, 2026
55 checks passed
vstinner deleted the clear15 branch October 10, 2026 20:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL