Title: [3.14] change in behaviour in gc.get_referrers(some_local) · Issue #125603 · python/cpython · GitHub
Open Graph Title: [3.14] change in behaviour in gc.get_referrers(some_local) · Issue #125603 · python/cpython
X Title: [3.14] change in behaviour in gc.get_referrers(some_local) · Issue #125603 · python/cpython
Description: Bug report Bug description: import gc async def demo(): class A: pass a = A() print(gc.get_referrers(a)) try: demo().send(None) except StopIteration as e: print(f"{e.value=}") on 3.11-3.13 this prints: [] e.value=None on 3.14 this prints...
Open Graph Description: Bug report Bug description: import gc async def demo(): class A: pass a = A() print(gc.get_referrers(a)) try: demo().send(None) except StopIteration as e: print(f"{e.value=}") on 3.11-3.13 this pri...
X Description: Bug report Bug description: import gc async def demo(): class A: pass a = A() print(gc.get_referrers(a)) try: demo().send(None) except StopIteration as e: print(f"{e.value=}") on 3.11-3.1...
Opengraph URL: https://github.com/python/cpython/issues/125603
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[3.14] change in behaviour in gc.get_referrers(some_local)","articleBody":"# Bug report\r\n\r\n### Bug description:\r\n\r\n```python\r\nimport gc\r\n\r\nasync def demo():\r\n class A:\r\n pass\r\n\r\n a = A()\r\n print(gc.get_referrers(a))\r\n\r\n\r\ntry:\r\n demo().send(None)\r\nexcept StopIteration as e:\r\n print(f\"{e.value=}\")\r\n```\r\n\r\non 3.11-3.13 this prints:\r\n\r\n```\r\n[]\r\ne.value=None\r\n```\r\n\r\non 3.14 this prints:\r\n```\r\n[\u003ccoroutine object demo at 0x7d00fff85000\u003e]\r\ne.value=None\r\n```\r\n\r\nthis makes gc.get_referrers less useful in detecting cyclic garbage where I'd like to be able to make the assertion that the current frame is the only referrer to an Exception.\r\n\r\nthe alternative is to hold a weak reference to the object, delete the object and see if the weak reference is dead with the gc disabled. But then I don't get any debug information in my failing test of why the object is still alive.\r\n\r\n### CPython versions tested on:\r\n\r\n3.14, CPython main branch\r\n\r\n### Operating systems tested on:\r\n\r\nLinux\r\n\r\nnote: @markshannon asked me to open this issue\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-125640\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/graingert","@type":"Person","name":"graingert"},"datePublished":"2024-10-16T16:04:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/125603/cpython/issues/125603"}
| 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:90124e45-0212-a064-7263-8d2b02d5f492 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E2B0:1A425C:1144AAB:16B703B:696B71E6 |
| html-safe-nonce | b293226818dedee28d6cdcca5f20a1c078af0a1a8c10dae2fbc525206772af76 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMkIwOjFBNDI1QzoxMTQ0QUFCOjE2QjcwM0I6Njk2QjcxRTYiLCJ2aXNpdG9yX2lkIjoiNzUwMjI5MTgxNjA1NzM2OTA2MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b6a466a01f6c42aacc626ed137a89bad1268a580ab40776e279ffdce13c049ab |
| hovercard-subject-tag | issue:2592352950 |
| 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/125603/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0508c29104da2be317bfa905cc44450aec36bd19c40afdb2dd37db6b7e157e7a/python/cpython/issues/125603 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0508c29104da2be317bfa905cc44450aec36bd19c40afdb2dd37db6b7e157e7a/python/cpython/issues/125603 |
| og:image:alt | Bug report Bug description: import gc async def demo(): class A: pass a = A() print(gc.get_referrers(a)) try: demo().send(None) except StopIteration as e: print(f"{e.value=}") on 3.11-3.13 this pri... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | graingert |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| 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 | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width