Skip to content

gh-161875: Push NULL and None in GET_ANEXT - #161877

Merged
asvetlov merged 1 commit into
python:mainfrom
asvetlov:gh-161875-get-anext
Nov 19, 2026
Merged

asvetlov merged 1 commit into
python:mainfrom
asvetlov:gh-161875-get-anext

Conversation

@asvetlov

@asvetlov asvetlov commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

GET_ANEXT was always followed by PUSH_NULL; LOAD_CONST None to set up the stack for SEND. It now pushes (aiter, awaitable, NULL, None) itself, so each async for iteration (including async comprehensions and async generator expressions) runs GET_ANEXT; SEND.

🤖 Generated with Claude Code

@asvetlov asvetlov added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Nov 12, 2026
@asvetlov
asvetlov marked this pull request as ready for review November 12, 2026 15:36
Every async for iteration compiled to GET_ANEXT; PUSH_NULL;
LOAD_CONST None; SEND. GET_ANEXT is always followed by that pair, so let
it push (aiter, awaitable, NULL, None) itself, saving two dispatches per
iteration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@asvetlov
asvetlov force-pushed the gh-161875-get-anext branch from 273c4db to 570ddbd Compare November 19, 2026 20:27
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #36024172 | 📁 Comparing 570ddbd against main (f15999d)

  🔍 Preview build  

2 files changed
± library/dis.html
± whatsnew/changelog.html

@asvetlov
asvetlov merged commit 865d8d8 into python:main Nov 19, 2026
92 of 94 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

interpreter-core (Objects, Python, Grammar, and Parser dirs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant