Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
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
gh-132775: Add _PyCode_ReturnsOnlyNone()#132981
Uh oh!
There was an error while loading.Please reload this page.
Conversation
I think this name is confusing because a function returning |
Objects/codeobject.c Outdated
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) { |
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.
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
.
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.
done
96a7fb9
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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.