GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GH-145667: Merge `GET_ITER` and `GET_YIELD_FROM_ITER` by markshannon · Pull Request #146120 · python/cpython

Conversation

@markshannon

@markshannon markshannon commented Mar 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Also modifies SEND to make it a bit more like FOR_ITER as both are now fed by GET_ITER.

Apart from saving an opcode, this will enable broadly similar optimizations to be applied to SEND as are already applied to FOR_ITER. Which will be able to:

  • significantly improve the performance of yield from seq where seq is a common iterable, like list.
  • allow the JIT to trace through SEND as it will be mostly specialized.

For now, this is broadly performance neutral, between +0% and -1%, mostly about 0%.

  • Issue: Merge the GET_ITER and GET_YIELD_FROM_ITER instructions #145667

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@markshannon
Merge GET_ITER and GET_YIELD_FROM_ITER. Modify SEND to make it a bit …
29a99f4
…more like FOR_ITER
@markshannon
markshannon requested review from Fidget-Spinner, ericsnowcurrently, iritkatriel, pablogsal, savannahostrowski and tomasr8 as code owners March 18, 2026 16:05
@bedevere-app bedevere-app Bot mentioned this pull request Mar 18, 2026
Merge the GET_ITER and GET_YIELD_FROM_ITER instructions #145667
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label Mar 18, 2026
markshannon added 2 commits March 20, 2026 11:34
@markshannon
Add news
34b75e4
@markshannon
Merge branch 'main' into breakup-yield-from-iter
e3ea233
diegorusso
diegorusso approved these changes Mar 20, 2026
View reviewed changes

@diegorusso diegorusso left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Just a nit

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Include/internal/pycore_magic_number.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Mar 20, 2026
@Fidget-Spinner

Fidget-Spinner commented Mar 20, 2026

Copy link
Copy Markdown
Member

Just to be sure, please run the buildbots

markshannon reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@markshannon markshannon added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Mar 20, 2026
@bedevere-bot

bedevere-bot commented Mar 20, 2026

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @markshannon for commit e3ea233 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F146120%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Mar 20, 2026
@markshannon
Merge branch 'main' into breakup-yield-from-iter
1b8f043
@markshannon markshannon added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Mar 20, 2026
@bedevere-bot

bedevere-bot commented Mar 20, 2026

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @markshannon for commit 1b8f043 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F146120%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Mar 20, 2026
@markshannon

markshannon commented Mar 21, 2026

Copy link
Copy Markdown
Member Author

Of the 12 failing buildbots, 7 were pre-existing failures and 5 are "new" refleaks.
I put "new" in quotes as there is no easy way to tell whether they were introduced by this PR, another recent PR, or merely exposed by this PR.

However, since this PR is platform independent, there should be leaks everywhere or nowhere.
Also, if GET_ITER or SEND were leaking, then there would be lots of refleaks on many buildbots (and there aren't).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@markshannon
markshannon merged commit 879c85f into python:main Mar 21, 2026
147 of 160 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Mar 21, 2026
@bedevere-bot

bedevere-bot commented Mar 21, 2026

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot ARM64 MacOS M1 Refleaks NoGIL 3.x (tier-2) has failed when building commit 879c85f.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1368/builds/4857) and take a look at the build logs.
  4. Check if the failure is related to this commit (879c85f) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1368/builds/4857

Failed tests:

  • test_urllib2net

Summary of the results of the build (if available):

==

Click to see traceback logs
remote: Enumerating objects: 80, done.        
remote: Counting objects:   1% (1/66)        
remote: Counting objects:   3% (2/66)        
remote: Counting objects:   4% (3/66)        
remote: Counting objects:   6% (4/66)        
remote: Counting objects:   7% (5/66)        
remote: Counting objects:   9% (6/66)        
remote: Counting objects:  10% (7/66)        
remote: Counting objects:  12% (8/66)        
remote: Counting objects:  13% (9/66)        
remote: Counting objects:  15% (10/66)        
remote: Counting objects:  16% (11/66)        
remote: Counting objects:  18% (12/66)        
remote: Counting objects:  19% (13/66)        
remote: Counting objects:  21% (14/66)        
remote: Counting objects:  22% (15/66)        
remote: Counting objects:  24% (16/66)        
remote: Counting objects:  25% (17/66)        
remote: Counting objects:  27% (18/66)        
remote: Counting objects:  28% (19/66)        
remote: Counting objects:  30% (20/66)        
remote: Counting objects:  31% (21/66)        
remote: Counting objects:  33% (22/66)        
remote: Counting objects:  34% (23/66)        
remote: Counting objects:  36% (24/66)        
remote: Counting objects:  37% (25/66)        
remote: Counting objects:  39% (26/66)        
remote: Counting objects:  40% (27/66)        
remote: Counting objects:  42% (28/66)        
remote: Counting objects:  43% (29/66)        
remote: Counting objects:  45% (30/66)        
remote: Counting objects:  46% (31/66)        
remote: Counting objects:  48% (32/66)        
remote: Counting objects:  50% (33/66)        
remote: Counting objects:  51% (34/66)        
remote: Counting objects:  53% (35/66)        
remote: Counting objects:  54% (36/66)        
remote: Counting objects:  56% (37/66)        
remote: Counting objects:  57% (38/66)        
remote: Counting objects:  59% (39/66)        
remote: Counting objects:  60% (40/66)        
remote: Counting objects:  62% (41/66)        
remote: Counting objects:  63% (42/66)        
remote: Counting objects:  65% (43/66)        
remote: Counting objects:  66% (44/66)        
remote: Counting objects:  68% (45/66)        
remote: Counting objects:  69% (46/66)        
remote: Counting objects:  71% (47/66)        
remote: Counting objects:  72% (48/66)        
remote: Counting objects:  74% (49/66)        
remote: Counting objects:  75% (50/66)        
remote: Counting objects:  77% (51/66)        
remote: Counting objects:  78% (52/66)        
remote: Counting objects:  80% (53/66)        
remote: Counting objects:  81% (54/66)        
remote: Counting objects:  83% (55/66)        
remote: Counting objects:  84% (56/66)        
remote: Counting objects:  86% (57/66)        
remote: Counting objects:  87% (58/66)        
remote: Counting objects:  89% (59/66)        
remote: Counting objects:  90% (60/66)        
remote: Counting objects:  92% (61/66)        
remote: Counting objects:  93% (62/66)        
remote: Counting objects:  95% (63/66)        
remote: Counting objects:  96% (64/66)        
remote: Counting objects:  98% (65/66)        
remote: Counting objects: 100% (66/66)        
remote: Counting objects: 100% (66/66), done.        
remote: Compressing objects:   3% (1/30)        
remote: Compressing objects:   6% (2/30)        
remote: Compressing objects:  10% (3/30)        
remote: Compressing objects:  13% (4/30)        
remote: Compressing objects:  16% (5/30)        
remote: Compressing objects:  20% (6/30)        
remote: Compressing objects:  23% (7/30)        
remote: Compressing objects:  26% (8/30)        
remote: Compressing objects:  30% (9/30)        
remote: Compressing objects:  33% (10/30)        
remote: Compressing objects:  36% (11/30)        
remote: Compressing objects:  40% (12/30)        
remote: Compressing objects:  43% (13/30)        
remote: Compressing objects:  46% (14/30)        
remote: Compressing objects:  50% (15/30)        
remote: Compressing objects:  53% (16/30)        
remote: Compressing objects:  56% (17/30)        
remote: Compressing objects:  60% (18/30)        
remote: Compressing objects:  63% (19/30)        
remote: Compressing objects:  66% (20/30)        
remote: Compressing objects:  70% (21/30)        
remote: Compressing objects:  73% (22/30)        
remote: Compressing objects:  76% (23/30)        
remote: Compressing objects:  80% (24/30)        
remote: Compressing objects:  83% (25/30)        
remote: Compressing objects:  86% (26/30)        
remote: Compressing objects:  90% (27/30)        
remote: Compressing objects:  93% (28/30)        
remote: Compressing objects:  96% (29/30)        
remote: Compressing objects: 100% (30/30)        
remote: Compressing objects: 100% (30/30), done.        
remote: Total 80 (delta 40), reused 36 (delta 36), pack-reused 14 (from 2)        
From https://github.com/python/cpython
 * branch                    main       -> FETCH_HEAD
Note: switching to '879c85f6e4ca8424ff6b4fddfbc946889572bf13'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 879c85f6e4c GH-145667: Merge `GET_ITER` and `GET_YIELD_FROM_ITER` (GH-146120)
Switched to and reset branch 'main'

configure: WARNING: pkg-config is missing. Some dependencies may not be detected correctly.

make: *** [buildbottest] Error 2
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

CuriousLearner added a commit to CuriousLearner/cpython that referenced this pull request Mar 22, 2026
@CuriousLearner
Merge remote-tracking branch 'upstream/main' into fix-pythongh-138577
2691ad9
* upstream/main: (1475 commits)
  Docs: replace all `datetime` imports with `import datetime as dt` (python#145640)
  pythongh-146153: Use `frozendict` in pure python fallback for `curses.has_key` (python#146154)
  pythongh-138234: clarify returncode behavior for subprocesses created with `shell=True` (python#138536)
  pythongh-140947: fix contextvars handling for server tasks in asyncio  (python#141158)
  pythonGH-100108: Add async generators best practices section (python#141885)
  pythonGH-145667: Merge `GET_ITER` and `GET_YIELD_FROM_ITER` (pythonGH-146120)
  pythongh-146228: Better fork support in cached FastPath (python#146231)
  pythongh-146227: Fix wrong type in _Py_atomic_load_uint16 in pyatomic_std.h (pythongh-146229)
  pythongh-145980: Fix copy/paste mistake in binascii.c (python#146230)
  pythongh-146092: Raise MemoryError on allocation failure in _zoneinfo (python#146165)
  pythongh-91279: Note `SOURCE_DATE_EPOCH` support in `ZipFile.writestr()` doc (python#139396)
  pythongh-146196: Fix Undefined Behavior in _PyUnicodeWriter_WriteASCIIString() (python#146201)
  pythongh-143930: Reject leading dashes in webbrowser URLs
  pythongh-145916: Soft-deprecate ctypes.util.find_library (pythonGH-145919)
  pythongh-146205: Check the errno with != 0 in close impls in select module (python#146206)
  pythongh-146171: Fix nested AttributeError suggestions (python#146188)
  pythongh-146099: Optimize _GUARD_CODE_VERSION+IP via function version symbols (pythonGH-146101)
  pythongh-145980: Add support for alternative alphabets in the binascii module (pythonGH-145981)
  pythongh-145754: Update signature retrieval in unittest.mock to use forwardref annotation format (python#145756)
  pythongh-145177: Add emscripten run --test, uses test args from config.toml (python#146160)
  ...
@pablogsal pablogsal mentioned this pull request Apr 4, 2026
gh-130273: Fix traceback color output with unicode characters #142529
Merged
cdce8p
cdce8p reviewed Apr 21, 2026
View reviewed changes
Comment thread Python/specialize.c
if (instructions[i].op.code == GET_ITER) {
fixup_getiter(&instructions[i], flags);
}
i += _PyOpcode_Caches[opcode];

@cdce8p cdce8p Apr 21, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

opcode isn't defined here if not ENABLE_SPECIALIZATION. This causes a build error, see #148825. Possible fix in #148826.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
@markshannon @ljfp
pythonGH-145667: Merge GET_ITER and GET_YIELD_FROM_ITER (pythonGH…
8e8a5b1
…-146120)

* Merge GET_ITER and GET_YIELD_FROM_ITER. Modify SEND to make it a bit more like FOR_ITER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@diegorusso diegorusso diegorusso approved these changes
@pablogsal pablogsal Awaiting requested review from pablogsal pablogsal is a code owner
@tomasr8 tomasr8 Awaiting requested review from tomasr8 tomasr8 is a code owner
@Fidget-Spinner Fidget-Spinner Awaiting requested review from Fidget-Spinner Fidget-Spinner is a code owner
@savannahostrowski savannahostrowski Awaiting requested review from savannahostrowski
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner
@iritkatriel iritkatriel Awaiting requested review from iritkatriel iritkatriel is a code owner
+1 more reviewer
@cdce8p cdce8p cdce8p left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@markshannon @Fidget-Spinner @bedevere-bot @diegorusso @cdce8p
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.