Title: gh-149557: Make itertools.pairwise safe under re-entry and concurrency by eendebakpt · Pull Request #150589 · python/cpython · GitHub
Open Graph Title: gh-149557: Make itertools.pairwise safe under re-entry and concurrency by eendebakpt · Pull Request #150589 · python/cpython
X Title: gh-149557: Make itertools.pairwise safe under re-entry and concurrency by eendebakpt · Pull Request #150589 · python/cpython
Description: Add a re-entrancy guard so a same-thread re-entrant call (e.g. when the input iterator's __next__ calls back into pairwise.__next__) raises RuntimeError instead of crashing or producing garbled output. Matches the behavior of itertools.tee and of generators, and fixes the use-after-free crash reported in gh-149557. (instead of raising RuntimeError we could consider raising ValueError) Wrap pairwise.__next__ in a critical section so concurrent callers from different threads serialize cleanly in the free-threaded build. Also addresses #123471
Open Graph Description: Add a re-entrancy guard so a same-thread re-entrant call (e.g. when the input iterator's __next__ calls back into pairwise.__next__) raises RuntimeError instead of crashing or producing garble...
X Description: Add a re-entrancy guard so a same-thread re-entrant call (e.g. when the input iterator's __next__ calls back into pairwise.__next__) raises RuntimeError instead of crashing or producing ga...
Opengraph URL: https://github.com/python/cpython/pull/150589
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ab4af231-b58a-20f7-0972-0eba0d523033 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CA86:1699ED:ADCA32:E86721:6A599734 |
| html-safe-nonce | efa69d26fcaf4045b8a5c6424127cfbb441d4118ddbf20ff483babb09b83edaf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTg2OjE2OTlFRDpBRENBMzI6RTg2NzIxOjZBNTk5NzM0IiwidmlzaXRvcl9pZCI6Ijc2NDI1MjY5NDM1Nzg1Mjc1NDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3c09d78dd5d6dc355b52170ea948e727fa481965d8323d0172c6ec84a0251e04 |
| hovercard-subject-tag | pull_request:3771188584 |
| 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/150589/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 | Add a re-entrancy guard so a same-thread re-entrant call (e.g. when the input iterator's __next__ calls back into pairwise.__next__) raises RuntimeError instead of crashing or producing garble... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a540949572872b935b393b36db38922db390ae71c859537d741b8f3eb7e545b5 |
| 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 | 737e0bf019c29d8431b268ae84d528b052789210 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width