Title: `decimal.getcontext` crashes with `--with-decimal-contextvar=no` and `-X showrefcount` · Issue #123657 · python/cpython · GitHub
Open Graph Title: `decimal.getcontext` crashes with `--with-decimal-contextvar=no` and `-X showrefcount` · Issue #123657 · python/cpython
X Title: `decimal.getcontext` crashes with `--with-decimal-contextvar=no` and `-X showrefcount` · Issue #123657 · python/cpython
Description: Crash report What happened? cc @godlygeek, who helped me find this I was investigating a reference leak on the asyncio test suite, and I came across decimal.getcontext leaking some memory. Here's what I was doing: $ ./python -Xshowrefcou...
Open Graph Description: Crash report What happened? cc @godlygeek, who helped me find this I was investigating a reference leak on the asyncio test suite, and I came across decimal.getcontext leaking some memory. Here's w...
X Description: Crash report What happened? cc @godlygeek, who helped me find this I was investigating a reference leak on the asyncio test suite, and I came across decimal.getcontext leaking some memory. Here'...
Opengraph URL: https://github.com/python/cpython/issues/123657
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`decimal.getcontext` crashes with `--with-decimal-contextvar=no` and `-X showrefcount`","articleBody":"# Crash report\r\n\r\n### What happened?\r\n\r\ncc @godlygeek, who helped me find this\r\n\r\nI was investigating a reference leak on the asyncio test suite, and I came across `decimal.getcontext` leaking some memory. Here's what I was doing:\r\n\r\n```\r\n$ ./python -Xshowrefcount -c \"import decimal; decimal.getcontext()\"\r\n[207 refs, 0 blocks]\r\n```\r\n\r\nThis is a problem in itself, since this is a leak, but after configuring with `--with-decimal-contextvar=no`, then the above code fails with a negative reference count:\r\n\r\n```\r\nPython/gc.c:92: gc_decref: Assertion \"gc_get_refs(g) > 0\" failed: refcount is too small\r\nEnable tracemalloc to get the memory block allocation traceback\r\n\r\nobject address : 0x5d3d7d336490\r\nobject refcount : 1\r\nobject type : 0x5d3d7d4acd50\r\nobject type name: decimal.Context\r\nobject repr : Context(prec=28, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999, capitals=1, clamp=0, flags=[], traps=[InvalidOperation, DivisionByZero, Overflow])\r\n```\r\n\r\nIt seems both of these problems were caused by #123244\r\n\r\n(@encukou, this needs `extension-modules`, `3.14` and `3.13`)\r\n\r\n### CPython versions tested on:\r\n\r\nCPython main branch\r\n\r\n### Operating systems tested on:\r\n\r\nLinux\r\n\r\n### Output from running 'python -VV' on the command line:\r\n\r\n_No response_\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-123703\n* gh-123774\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/ZeroIntensity","@type":"Person","name":"ZeroIntensity"},"datePublished":"2024-09-04T01:54:03Z","url":"https://github.com/python/cpython/issues/123657"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:b2c17fca-f5a7-7917-10d9-9ed125f493d1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A2A0:14394F:4EC0A6:6A26AC:6B067D32 |
| html-safe-nonce | 2655104be86f27d0544e6d195d6188a4bffa928bcb00955036a2dd6bfd7df8ad |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMkEwOjE0Mzk0Rjo0RUMwQTY6NkEyNkFDOjZCMDY3RDMyIiwidmlzaXRvcl9pZCI6IjQ2NjQyMjAyOTgyMzE0NzMxNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 979da9573cb94f09d3707763e392a4a21ae266d09c47cbf391e098ce74c455a9 |
| hovercard-subject-tag | issue:2504127840 |
| 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/123657/issue_layout |
| twitter:image | https://opengraph.githubassets.com/63dc69e131b34234fb0333419eb37193a8a14ec6bd34637a1b18b19428052292/python/cpython/issues/123657 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/63dc69e131b34234fb0333419eb37193a8a14ec6bd34637a1b18b19428052292/python/cpython/issues/123657 |
| og:image:alt | Crash report What happened? cc @godlygeek, who helped me find this I was investigating a reference leak on the asyncio test suite, and I came across decimal.getcontext leaking some memory. Here's w... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ZeroIntensity |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4462ff7ebfd3d551f202659f2423dae617b6849d23b1df6465dc504ef497d14a |
| 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 | 6d3909414814ff86ce7da4c51a0f4918a13fb41b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width