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-132775: Add _PyCode_ReturnsOnlyNone()#132981

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

ericsnowcurrently
Copy link
Member

@ericsnowcurrentlyericsnowcurrently commentedApr 25, 2025
edited by bedevere-appbot
Loading

The function indicates whether or not the function has a return statement.

This is used by a later change related treating some functions like scripts.

@ericsnowcurrentlyericsnowcurrently changed the titleAdd _PyCode_Returns()gh-132775: Add _PyCode_Returns()Apr 25, 2025
@iritkatriel
Copy link
Member

I think this name is confusing because a function returningNone also returns.

Py_ssize_t len = Py_SIZE(co);
for (int i = 0; i < len; i++) {
_Py_CODEUNIT inst = _Py_GetBaseCodeUnit(co, i);
if (inst.op.code == RETURN_VALUE) {
Copy link
Member

Choose a reason for hiding this comment

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

In the past we also hadRETURN_CONST and we might have something like that in the future, so I think we should make this more robust. Perhaps add a macro in Include/internal/pycore_opcode_utils.h (sayIS_RETURN_OPCODE). Also use this new macro inbasicblock_returns inflowgraph.c.

ericsnowcurrently reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

done

@ericsnowcurrentlyericsnowcurrently merged commit96a7fb9 intopython:mainApr 29, 2025
41 checks passed
@ericsnowcurrentlyericsnowcurrently deleted the add-pycode-returns branchApril 29, 2025 02:12
@AA-TurnerAA-Turner changed the titlegh-132775: Add _PyCode_Returns()gh-132775: Add _PyCode_ReturnsOnlyNone()May 2, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@iritkatrieliritkatrieliritkatriel left review comments

@markshannonmarkshannonAwaiting requested review from markshannonmarkshannon is a code owner

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@ericsnowcurrently@iritkatriel

[8]ページ先頭

©2009-2025 Movatter.jp