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

bpo-43683: Handle generator entry in bytecode#25138

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

Conversation

@markshannon
Copy link
Member

@markshannonmarkshannon commentedApr 1, 2021
edited by bedevere-bot
Loading

Adds GEN_START bytecode to handle checking for None when starting a generator or coroutine.

This means that:

  • send() doesn't need to check the state of the generator.
  • Should speed up iteration as check is only performed once per generator, not once per iteration.

https://bugs.python.org/issue43683

Copy link
Contributor

@willingcwillingc left a comment

Choose a reason for hiding this comment

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

LGTM

…o bytecode.Document new bytecode and make it fail gracefully if mis-compiled.Add NEWS itemBump magic number.
entryblock=b;
}

if (insert_generator_prefix(c,entryblock)) {
Copy link
Member

Choose a reason for hiding this comment

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

If we're compiling a generator (or coroutine etc.) the new function assumes (without asserting) that entryblock is not NULL. But evidently it could be, since below on line 6690 there's a check whether it could be. I don't know how it could be NULL - that would mean there's no code in the function at all, but it seems there's code above that always adds at least one instruction (RETURN_VALUE on line 6668). So maybe the check for entryblock == NULL below can be replaced by an assert? (I'd place that assert right underneath the for-loop above on lines 6683-6686.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

entryblock cannot be NULL. I'll add the assert.

@pythonpython deleted a comment fromfochoaoApr 6, 2021
@markshannon
Copy link
MemberAuthor

Fixes are in#25224

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@willingcwillingcwillingc left review comments

@gvanrossumgvanrossumgvanrossum left review comments

@1st11st1Awaiting requested review from 1st1

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@willingc@gvanrossum@the-knights-who-say-ni@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp