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

gh-143939: Fix assignment to `_PyThreadStateImpl.generator_return_kind` by colesbury · Pull Request #143951 · python/cpython · GitHub

/ cpython Public

gh-143939: Fix assignment to _PyThreadStateImpl.generator_return_kind - #143951

Merged
colesbury merged 2 commits into
python:mainfrom
colesbury:gh-143939-coro-bug
Jan 20, 2026
Merged

gh-143939: Fix assignment to _PyThreadStateImpl.generator_return_kind#143951
colesbury merged 2 commits into
python:mainfrom
colesbury:gh-143939-coro-bug

Conversation

colesbury commented Jan 17, 2026
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

The assignment to generator_return_kind must be after any potentially escaping calls to ensure that it's not overwritten.

…n_kind

The assignment to generator_return_kind has to be after any potentially
escaping calls or it might be overwritten.
Comment on lines +2271 to +2279
class CallGeneratorOnDealloc:
def __del__(self):
def gen():
yield 1
next(gen())

async def coro():
obj = CallGeneratorOnDealloc()
return 42

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

A little bit smaller in size:

Suggested change
class CallGeneratorOnDealloc:
def __del__(self):
def gen():
yield 1
next(gen())
async def coro():
obj = CallGeneratorOnDealloc()
return 42
class CallGeneratorOnDealloc:
def __del__(self):
next(x for x in [42])
async def coro():
obj = CallGeneratorOnDealloc()

kumaraditya303 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

colesbury enabled auto-merge (squash) January 20, 2026 17:25
colesbury disabled auto-merge January 20, 2026 17:26
colesbury enabled auto-merge (squash) January 20, 2026 17:26
colesbury merged commit 43bb630 into python:main Jan 20, 2026
53 checks passed
colesbury deleted the gh-143939-coro-bug branch February 5, 2026 16:59
thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request Feb 15, 2026
…rn_kind` (pythongh-143951)

The assignment to generator_return_kind has to be after any potentially
escaping calls to ensure that it's not overwritten.
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.

3 participants


Back | FazBrowse Home | New Git URL