Title: gh-123471: Make concurrent iteration over itertools.accumulate thread-safe by eendebakpt · Pull Request #144486 · python/cpython · GitHub
Open Graph Title: gh-123471: Make concurrent iteration over itertools.accumulate thread-safe by eendebakpt · Pull Request #144486 · python/cpython
X Title: gh-123471: Make concurrent iteration over itertools.accumulate thread-safe by eendebakpt · Pull Request #144486 · python/cpython
Description: We use a critical section similar to the approach in #132814. Note: the accumulate has mutable internal state lz->initial and lz->total. With some refactoring we can replace the lz->init pointer with a C int (where atomics can be used), but the lz->total remains a pointer that is mutated on each iteration. A side benefit of the refactoring would be that a decref in accumulate_dealloc is avoided and visit in accumulate_traverse. I decided not to include the refactoring in this PR (it would involve some churn), but if a core dev feels otherwise I will include it. Issue: gh-123471
Open Graph Description: We use a critical section similar to the approach in #132814. Note: the accumulate has mutable internal state lz->initial and lz->total. With some refactoring we can replace the lz->init p...
X Description: We use a critical section similar to the approach in #132814. Note: the accumulate has mutable internal state lz->initial and lz->total. With some refactoring we can replace the lz-&a...
Opengraph URL: https://github.com/python/cpython/pull/144486
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:0409dac2-ce59-68a5-d652-e8ef922141b5 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B8C6:22F661:A72361:E427D7:6A57E120 |
| html-safe-nonce | 49eed65b9a185d96dd2ac76b27ecf705bc0e1eaa90c9723ad3c0833690ad03e1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOEM2OjIyRjY2MTpBNzIzNjE6RTQyN0Q3OjZBNTdFMTIwIiwidmlzaXRvcl9pZCI6Ijg5MjM3MjMxMTgyNjg2Mzc0NzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3d4e5ed3553af945a447ffee1ea761ac5d0b0fd402589a991f1eca9920ffaeee |
| hovercard-subject-tag | pull_request:3247342423 |
| 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/144486/files |
| twitter:image | https://avatars.githubusercontent.com/u/883786?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/883786?s=400&v=4 |
| og:image:alt | We use a critical section similar to the approach in #132814. Note: the accumulate has mutable internal state lz->initial and lz->total. With some refactoring we can replace the lz->init p... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 837767abbd14b05f219fd812ef2842c659968b63619e1b966dded83972ab5bca |
| 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 | 36b9c371e4e031091f1b89adf913d9e6993943df |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width