Title: gh-149816: #96 Fix a race condition in invoke_gc_callback with free threading by dzaramelcone · Pull Request #150029 · python/cpython · GitHub
Open Graph Title: gh-149816: #96 Fix a race condition in invoke_gc_callback with free threading by dzaramelcone · Pull Request #150029 · python/cpython
X Title: gh-149816: #96 Fix a race condition in invoke_gc_callback with free threading by dzaramelcone · Pull Request #150029 · python/cpython
Description: The optimization that avoided allocating an info dict when no gc callbacks were registered introduces a time of check to time of use race in free threaded mode (lineno 1943-1955). I just pulled out the check. Since info is always non-null, I also replaced XDECREF use with DECREF. (lineno 1959, lineno 1982). I implemented a stress test for this and uncovered what I believe to be a bug with _PyList_GetItemRef. I am following suit with python/cpython#149909 and not including the test with my PR for two reasons: My implementation was resource intensive and not deterministic. I didn't want to scope creep fixing the bug with _PyList_GetItemRef (but I'm happy to open an issue for it!) also, this is my first PR against CPython, I am doing it from PyCon US as part of the sprint! :) Hello world! Issue: gh-149816
Open Graph Description: The optimization that avoided allocating an info dict when no gc callbacks were registered introduces a time of check to time of use race in free threaded mode (lineno 1943-1955). I just pulled out...
X Description: The optimization that avoided allocating an info dict when no gc callbacks were registered introduces a time of check to time of use race in free threaded mode (lineno 1943-1955). I just pulled out...
Opengraph URL: https://github.com/python/cpython/pull/150029
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:1ccebc78-58e1-ad33-e031-f91682607ed0 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C000:17E40D:43B951:5BEC75:6A524A79 |
| html-safe-nonce | 4f269f0b07f7a77305f58b7b27a1debaa1e53b187614e1e8b7ff0b02ea8efb5b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDAwOjE3RTQwRDo0M0I5NTE6NUJFQzc1OjZBNTI0QTc5IiwidmlzaXRvcl9pZCI6IjQ3NzAzNjAxMzgxMDMxNDcxMjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e1d4d1648d7946eb5327b6b1b1b01516f45fbeb823dadf60065076cc9f198e9e |
| hovercard-subject-tag | pull_request:3704922916 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/python/cpython/pull/150029/files |
| twitter:image | https://avatars.githubusercontent.com/u/134235821?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/134235821?s=400&v=4 |
| og:image:alt | The optimization that avoided allocating an info dict when no gc callbacks were registered introduces a time of check to time of use race in free threaded mode (lineno 1943-1955). I just pulled out... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width