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-127274: Defer nested methods#128012

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
mpage merged 5 commits intopython:mainfrommpage:gh-127274-method-flag
Dec 19, 2024
Merged

Conversation

@mpage
Copy link
Contributor

@mpagempage commentedDec 17, 2024
edited
Loading

Methods (functions defined in class scope) are likely to be cleaned up by the GC anyway, so deferring nested methods will not prolong their lifetime.

Add a new code flag,CO_METHOD, that is set for functions defined in a class scope. Use that when deciding to defer functions.

Methods (functions defined in class scope) are likely to be cleanedup by the GC anyway.Add a new code flag, `CO_METHOD`, that is set for functions definedin a class scope. Use that when deciding to defer functions.
Copy link
Contributor

@colesburycolesbury left a comment

Choose a reason for hiding this comment

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

LGTM

@JelleZijlstra
Copy link
Member

The otherCO_* constants are documented and exposed in the inspect module (e.g.https://docs.python.org/3.14/library/inspect.html#inspect.CO_HAS_DOCSTRING); we'll have to do that for this one too.

mpage reacted with thumbs up emoji

@mpage
Copy link
ContributorAuthor

The other CO_* constants are documented and exposed in the inspect module

Should that be done forCO_NO_MONITORING_EVENTS as well (in a separate PR)?

@mpagempage removed the skip news labelDec 18, 2024
@JelleZijlstra
Copy link
Member

Should that be done forCO_NO_MONITORING_EVENTS as well (in a separate PR)?

Wasn't aware of that flag, but if we also added that one recently, then yes.

@mpage
Copy link
ContributorAuthor

MacOS-13 build failure looks like an issue with homebrew that is unrelated to this PR.

@mpage
Copy link
ContributorAuthor

@JelleZijlstra - would you please have another look?

Copy link
Member

@JelleZijlstraJelleZijlstra left a comment

Choose a reason for hiding this comment

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

Looks good.

Could also add tests that look directly at the flags of a code object, but flags are documented as internal and an implementation detail and CO_HAS_DOCSTRINGS doesn't have tests either, so I think it's fine not to test this.

@mpagempage merged commit255762c intopython:mainDec 19, 2024
41 checks passed
@mpagempage deleted the gh-127274-method-flag branchDecember 19, 2024 21:03
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull requestDec 23, 2024
Methods (functions defined in class scope) are likely to be cleanedup by the GC anyway.Add a new code flag, `CO_METHOD`, that is set for functions definedin a class scope. Use that when deciding to defer functions.
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull requestJan 8, 2025
Methods (functions defined in class scope) are likely to be cleanedup by the GC anyway.Add a new code flag, `CO_METHOD`, that is set for functions definedin a class scope. Use that when deciding to defer functions.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@colesburycolesburycolesbury approved these changes

@JelleZijlstraJelleZijlstraJelleZijlstra approved these changes

@carljmcarljmAwaiting requested review from carljmcarljm is a code owner

@markshannonmarkshannonAwaiting requested review from markshannonmarkshannon is a code owner

@iritkatrieliritkatrielAwaiting requested review from iritkatrieliritkatriel is a code owner

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@mpage@JelleZijlstra@colesbury

[8]ページ先頭

©2009-2025 Movatter.jp