Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GH-143493: Conform to spec for generator expressions while supporting virtual iterators#143569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@markshannon
Copy link
Member

@markshannonmarkshannon commentedJan 8, 2026
edited by bedevere-appbot
Loading

  • Moves theGET_ITER instruction into the generator function preamble. This means the the iterable is converted into an iterator during generator creation, as documented, but keeps it in the same code object allowing optimization.

…erators* Moves the `GET_ITER` instruction into the generator function preamble.  This means the the iterable is converted into an iterator during generator  creation, as documented, but keeps it in the same code object allowing  optimization.
J2085isa

This comment was marked as spam.

J2085isa

This comment was marked as spam.

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

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

Sorry, the code was changed so much since I worked with it, that I can no longer make qualified review. I can understand particular changes, but I cannot catch if something was missed. The original idea looks reasonably.

BTW, what happens when__iter__() raises StopIteration?

Is similar change needed for asynchronous generators?

@markshannon
Copy link
MemberAuthor

markshannon commentedJan 9, 2026
edited
Loading

BTW, what happens when__iter__() raises StopIteration?

The exception is raised before the generator is created and the traceback shows the iterable as the location of the exception.

@markshannon
Copy link
MemberAuthor

Is similar change needed for asynchronous generators?

I don't think asynchronous generators were ever changed, so they still have the old behavior from 3.13 and earlier.

Copy link
Contributor

@DinoVDinoV left a comment

Choose a reason for hiding this comment

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

Other than the one nit looks good to me

int gen_index, int depth,
expr_ty elt, expr_ty val, int type,
int iter_on_stack)
IterStackState iter_on_stack)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Is it worth renaming these to something likeiter_state like it is incodegen_comprehension?

Copy link
MemberAuthor

@markshannonmarkshannonJan 15, 2026
edited
Loading

Choose a reason for hiding this comment

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

It isn't it state, it is its location. Maybe I'll renameIterStackState instead.

@markshannonmarkshannon merged commitae53da5 intopython:mainJan 16, 2026
71 checks passed
@bedevere-bot
Copy link

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

Hi! The buildbotARM64 macOS 3.x (tier-2) has failed when building commitae53da5.

What do you need to do:

  1. Don't panic.
  2. Checkthe 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/725/builds/12565) and take a look at the build logs.
  4. Check if the failure is related to this commit (ae53da5) 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/725/builds/12565

Failed tests:

  • test_urllib2net

Failed subtests:

  • test_call_count_thread_safe - test.test_unittest.testmock.testthreadingmock.TestThreadingMock.test_call_count_thread_safe
  • test_preauth_data_to_tls_server - test.test_ssl.TestPreHandshakeClose.test_preauth_data_to_tls_server

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

==

Click to see traceback logs
Traceback (most recent call last):  File"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_ssl.py", line5476, intest_preauth_data_to_tls_serverself.assertIn("before TLS handshake with data", wrap_error.args[1])~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError:'before TLS handshake with data' not found in '[SSL: RECORD_LAYER_FAILURE] record layer failure (_ssl.c:1096)'Traceback (most recent call last):  File"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_unittest/testmock/testthreadingmock.py", line219, intest_call_count_thread_safeself.assertEqual(m.call_count,LOOPS*THREADS)~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError:998 != 1000

meta-codesyncbot pushed a commit to facebookincubator/cinderx that referenced this pull requestJan 21, 2026
Summary:python/cpython#143569 has fixed a bug introduced in the code gen where passing a non-iterable to a generator doesn't raise immediately. This matches the code gen.Reviewed By: mpageDifferential Revision: D90706769fbshipit-source-id: 229a355c62e4b07ca0f3853ba91ac31b81946a8b
meta-codesyncbot pushed a commit to facebookincubator/cinderx that referenced this pull requestJan 22, 2026
Summary:Fixes up the CinderX build after the latest import. This brought inpython/cpython#142911 which move somethings into ceval.h so that we can directly include it rather than borrowing those functions. We bring back `cinderx-only-headers` and now use them on 3.10 and 3.15+.There's also a fix related topython/cpython#143569 where we need to update the interpreter loop.Alsopython/cpython@bb25f72 seems to have refactored `_PyDict_LookupIndex` to use `_PyDict_LookupIndexAndValue`.There's some more work after this to further reduce our usage of `ceval_macros.h` but this just gets things working again.Reviewed By: itamaroDifferential Revision: D91146024fbshipit-source-id: 6da3ef18fe5fe5f79e29a71cdbe98491bbb45a9d
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@serhiy-storchakaserhiy-storchakaserhiy-storchaka left review comments

@DinoVDinoVDinoV approved these changes

@iritkatrieliritkatrielAwaiting requested review from iritkatrieliritkatriel is a code owner

+1 more reviewer

@J2085isaJ2085isaJ2085isa left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@markshannon@bedevere-bot@DinoV@serhiy-storchaka@J2085isa

[8]ページ先頭

©2009-2026 Movatter.jp