Title: functools.lru_cache prevents function being cached from executing concurrently under free-threading · Issue #131757 · python/cpython · GitHub
Open Graph Title: functools.lru_cache prevents function being cached from executing concurrently under free-threading · Issue #131757 · python/cpython
X Title: functools.lru_cache prevents function being cached from executing concurrently under free-threading · Issue #131757 · python/cpython
Description: Feature or enhancement Proposal: functools.lru_cache was made free-thread safe but is not so in an efficient way. It works currently by serializing the function being cached and preventing it from executing concurrently even if it can. E...
Open Graph Description: Feature or enhancement Proposal: functools.lru_cache was made free-thread safe but is not so in an efficient way. It works currently by serializing the function being cached and preventing it from ...
X Description: Feature or enhancement Proposal: functools.lru_cache was made free-thread safe but is not so in an efficient way. It works currently by serializing the function being cached and preventing it from ...
Opengraph URL: https://github.com/python/cpython/issues/131757
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"functools.lru_cache prevents function being cached from executing concurrently under free-threading","articleBody":"# Feature or enhancement\n\n### Proposal:\n\n`functools.lru_cache` was made free-thread safe but is not so in an efficient way. It works currently by serializing the function being cached and preventing it from executing concurrently even if it can. Effectively, for the function being cached, it is as if the GIL still exists.\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 -->\n### Linked PRs\n* gh-131758\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/tom-pytel","@type":"Person","name":"tom-pytel"},"datePublished":"2025-03-26T10:51:14Z","url":"https://github.com/python/cpython/issues/131757"}
| 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:2df73d8d-5206-80af-e9b6-f0c4a06a62d2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B43C:380435:1081B94:14CEF1C:6B0241C5 |
| html-safe-nonce | 0d5d86511dd0f88668fec44720d78f42df0af088991957ba64177cce8f3978be |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNDNDOjM4MDQzNToxMDgxQjk0OjE0Q0VGMUM6NkIwMjQxQzUiLCJ2aXNpdG9yX2lkIjoiMjkwMjYzMDQ5NDkwNDY2NDUxNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d3aa7a1a63125988b1b6ea3c19151070c7a8854dc469a812bb73f997d5c06f92 |
| hovercard-subject-tag | issue:2949160822 |
| 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/131757/issue_layout |
| twitter:image | https://opengraph.githubassets.com/137e09ec2e47e1e4ae58118eb2466b85da476f84afdc207532d7529edd10fd17/python/cpython/issues/131757 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/137e09ec2e47e1e4ae58118eb2466b85da476f84afdc207532d7529edd10fd17/python/cpython/issues/131757 |
| og:image:alt | Feature or enhancement Proposal: functools.lru_cache was made free-thread safe but is not so in an efficient way. It works currently by serializing the function being cached and preventing it from ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tom-pytel |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width