Title: Defer functions defined in nested classes in free-threaded builds · Issue #127274 · python/cpython · GitHub
Open Graph Title: Defer functions defined in nested classes in free-threaded builds · Issue #127274 · python/cpython
X Title: Defer functions defined in nested classes in free-threaded builds · Issue #127274 · python/cpython
Description: Feature or enhancement Proposal: We currently only defer functions that do not have the CO_NESTED flag set: cpython/Objects/funcobject.c Lines 213 to 218 in 26ff32b if ((code_obj->co_flags & CO_NESTED) == 0) { // Use deferred reference c...
Open Graph Description: Feature or enhancement Proposal: We currently only defer functions that do not have the CO_NESTED flag set: cpython/Objects/funcobject.c Lines 213 to 218 in 26ff32b if ((code_obj->co_flags & CO_NES...
X Description: Feature or enhancement Proposal: We currently only defer functions that do not have the CO_NESTED flag set: cpython/Objects/funcobject.c Lines 213 to 218 in 26ff32b if ((code_obj->co_flags &...
Opengraph URL: https://github.com/python/cpython/issues/127274
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Defer functions defined in nested classes in free-threaded builds","articleBody":"# Feature or enhancement\n\n### Proposal:\n\nWe currently only defer functions that do not have the `CO_NESTED` flag set:\n\nhttps://github.com/python/cpython/blob/26ff32b30553e1f7b0cc822835ad2da8890c180c/Objects/funcobject.c#L213-L218\n\nThis also excludes functions defined on nested classes. In the example below, the `Foo.__init__` function will not use deferred reference counting because the `__init__` method's code object has the `CO_NESTED` flag set.\n\n```py\ndef func():\n class Foo:\n def __init__(self):\n pass\n```\n\nWe would like to relax the restriction on `CO_NESTED` to allow functions that are defined on nested classes to use deferred reference counting.\n\n### Has this already been discussed elsewhere?\n\nThis is a minor feature, which does not need previous discussion elsewhere\n\n### Links to previous discussion of this feature:\n\n_No response_\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-128012\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/mpage","@type":"Person","name":"mpage"},"datePublished":"2024-11-25T23:21:07.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/127274/cpython/issues/127274"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7646e159-158f-7b13-ac6a-34f5759f45cb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E2A2:390ECE:2C193AB:3FA75B9:6A56698A |
| html-safe-nonce | 3e97f9a1fe741853fd3a3837fc583c61bac44da549775684c45505408faf9cef |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMkEyOjM5MEVDRToyQzE5M0FCOjNGQTc1Qjk6NkE1NjY5OEEiLCJ2aXNpdG9yX2lkIjoiNjM4Mzc4MDkwNjU0MTY3Mjg0MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 42e01766e57103258149be722f709cb5d5a359d6d0c534abf1cd09d15024cf66 |
| hovercard-subject-tag | issue:2692565396 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/127274/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4de92e66568dcd5a23e28e66ae531671e2647636d90e1c48bf0367de86786a03/python/cpython/issues/127274 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4de92e66568dcd5a23e28e66ae531671e2647636d90e1c48bf0367de86786a03/python/cpython/issues/127274 |
| og:image:alt | Feature or enhancement Proposal: We currently only defer functions that do not have the CO_NESTED flag set: cpython/Objects/funcobject.c Lines 213 to 218 in 26ff32b if ((code_obj->co_flags & CO_NES... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mpage |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1bfcd903bf3318822b10b18a6332fac40d3a21f7d94456dca766ab8fa7328068 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 37f446b78ad53e6f593aa1a4243b87c76a3428ab |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width