Title: Make `_struct` module thread-safe in `--disable-gil` builds · Issue #112062 · python/cpython · GitHub
Open Graph Title: Make `_struct` module thread-safe in `--disable-gil` builds · Issue #112062 · python/cpython
X Title: Make `_struct` module thread-safe in `--disable-gil` builds · Issue #112062 · python/cpython
Description: Feature or enhancement The _struct module has a few small issues: The use of PyDict_GetItemWithError returns a borrowed reference (should use PyDict_GetItemRef) The state->cache is lazily created; we should instead create it during _stru...
Open Graph Description: Feature or enhancement The _struct module has a few small issues: The use of PyDict_GetItemWithError returns a borrowed reference (should use PyDict_GetItemRef) The state->cache is lazily created; ...
X Description: Feature or enhancement The _struct module has a few small issues: The use of PyDict_GetItemWithError returns a borrowed reference (should use PyDict_GetItemRef) The state->cache is lazily create...
Opengraph URL: https://github.com/python/cpython/issues/112062
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Make `_struct` module thread-safe in `--disable-gil` builds","articleBody":"# Feature or enhancement\r\n\r\nThe `_struct` module has a few small issues:\r\n\r\n* The use of `PyDict_GetItemWithError` returns a borrowed reference (should use `PyDict_GetItemRef`)\r\n* The `state-\u003ecache` is lazily created; we should instead create it during `_structmodule_exec`\r\n* We want `state-\u003ecache` to be an immutable reference to a mutable dict. (The `dict` will be thread-safe.) Use `PyDict_Clear` to empty the dict instead of clearing the reference.\r\n\r\n\r\nSee the commit from the `nogil-3.12` fork for context: https://github.com/colesbury/nogil-3.12/commit/ada9b73feb. Note that in CPython the relevant function is `PyDict_GetItemRef` not `PyDict_FetchItemWithError`.\r\n\r\n\u003c!-- gh-linked-prs --\u003e\r\n### Linked PRs\r\n* gh-112094\r\n\u003c!-- /gh-linked-prs --\u003e\r\n","author":{"url":"https://github.com/colesbury","@type":"Person","name":"colesbury"},"datePublished":"2023-11-14T16:45:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/112062/cpython/issues/112062"}
| 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:7ecb64a1-56cc-0402-ebe4-72d7a04a633e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 89DC:284E5C:205A2AC:2C6AE35:696ABBAA |
| html-safe-nonce | 7d5dc7bfd783d3d825a30a492ae157e75561000d443f2377f33547f17c46f1f2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OURDOjI4NEU1QzoyMDVBMkFDOjJDNkFFMzU6Njk2QUJCQUEiLCJ2aXNpdG9yX2lkIjoiMTc2OTE5NjY0ODQ2MjQ2NTk2MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3ca1d348a8553e105d784442e3e2c4d7d030d49bdaf2b15970d8f359e2f90242 |
| hovercard-subject-tag | issue:1993134665 |
| 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/112062/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2734736b864b187c39bd99c2bc1bf2a4fc10de482d0825cc463af9112740f6e9/python/cpython/issues/112062 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2734736b864b187c39bd99c2bc1bf2a4fc10de482d0825cc463af9112740f6e9/python/cpython/issues/112062 |
| og:image:alt | Feature or enhancement The _struct module has a few small issues: The use of PyDict_GetItemWithError returns a borrowed reference (should use PyDict_GetItemRef) The state->cache is lazily created; ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | colesbury |
| hostname | github.com |
| expected-hostname | github.com |
| None | 46ce962e0e18113ea447391b6ace8b02d4d2861e57b4fbab3658698f73d8855b |
| 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 | 30300f30bb3949de255e84a146706a3bdb5c19c9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width