Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
_PyCode_Returns() -> _PyCode_ReturnsValue().
  • Loading branch information
ericsnowcurrently committed Apr 29, 2025
commit 076b060ffa318fb12d4812eceee253722ed0deb3
2 changes: 1 addition & 1 deletion Include/internal/pycore_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ extern int _Py_ClearUnusedTLBC(PyInterpreterState *interp);
#endif


PyAPI_FUNC(int) _PyCode_Returns(PyCodeObject *);
PyAPI_FUNC(int) _PyCode_ReturnsValue(PyCodeObject *);


#ifdef __cplusplus
Expand Down
5 changes: 4 additions & 1 deletion Objects/codeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1690,8 +1690,11 @@ PyCode_GetFreevars(PyCodeObject *code)
}


/* Here "value" means a non-None value, since a bare return is identical
* to returning None explicitly. Likewise a missing return statement
* at the end of the function is turned into "return None". */
int
_PyCode_Returns(PyCodeObject *co)
_PyCode_ReturnsValue(PyCodeObject *co)
{
// Look up None in co_consts.
Py_ssize_t nconsts = PyTuple_Size(co->co_consts);
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy