Skip to content

GH-145667: Merge GET_ITER and GET_YIELD_FROM_ITER#146120

Merged
markshannon merged 4 commits intopython:mainfrom
markshannon:breakup-yield-from-iter
Mar 21, 2026
Merged

GH-145667: Merge GET_ITER and GET_YIELD_FROM_ITER#146120
markshannon merged 4 commits intopython:mainfrom
markshannon:breakup-yield-from-iter

Conversation

@markshannon
Copy link
Member

@markshannon markshannon commented Mar 18, 2026

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%.

Copy link
Contributor

@diegorusso diegorusso left a comment

Choose a reason for hiding this comment

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

Just a nit

@Fidget-Spinner
Copy link
Member

Just to be sure, please run the buildbots

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

🤖 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.

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

🤖 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.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Mar 20, 2026
@markshannon
Copy link
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).

@markshannon markshannon merged commit 879c85f into python:main Mar 21, 2026
147 of 160 checks passed
@bedevere-bot
Copy link

⚠️⚠️⚠️ 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

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.

5 participants