Skip to content

GH-128682: Change a couple of functions to only steal references on success.#129132

Merged
markshannon merged 1 commit intopython:mainfrom
faster-cpython:escaping-decref-4
Jan 22, 2025
Merged

GH-128682: Change a couple of functions to only steal references on success.#129132
markshannon merged 1 commit intopython:mainfrom
faster-cpython:escaping-decref-4

Conversation

@markshannon
Copy link
Copy Markdown
Member

@markshannon markshannon commented Jan 21, 2025

Changes the tow functions _PyTuple_FromStackRefSteal and _PyList_FromStackRefSteal to only steal references on success.
This makes the functions non-escaping as they only close any references if they fail.

The resulting API is a bit awkward, but as it is used it so few places that shouldn't be a problem.

@iritkatriel
Copy link
Copy Markdown
Member

I'd run the refleaks tests before merging.

@markshannon markshannon added the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Jan 21, 2025
@markshannon markshannon merged commit 470a0a6 into python:main Jan 22, 2025
@markshannon markshannon deleted the escaping-decref-4 branch January 22, 2025 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants