René's URL Explorer Experiment


Title: Align itertools source and callback lifetimes by youknowdot · Pull Request #9721 · RustPython/RustPython · GitHub

Open Graph Title: Align itertools source and callback lifetimes by youknowdot · Pull Request #9721 · RustPython/RustPython

X Title: Align itertools source and callback lifetimes by youknowdot · Pull Request #9721 · RustPython/RustPython

Description: Summary Align itertools callback state and source ownership with CPython 3.15, rebased onto main 3d0f6fc659b02733722ec658eb2be7c5a9288c68. Read accumulate's running total after source callbacks and release arithmetic operands before publishing the replacement total. Release converted non-exact-tuple starmap containers before calling the function; retain exact tuples through the call. Detach cycle's exhausted source after publishing replay state and preserve the outer call's replay index across finalizer reentry. Clear pairwise sources and previous items in the appropriate first/second-input failure order. Detach nonfinal exhausted zip_longest sources while retaining the final/error source and protecting the active count with its optional slots. State locks Cycle's source and saved items now share its existing PyRwLock. Pairwise's source and old item share its existing PyRwLock. This removes both additional source mutexes while retaining typed PyIter fields. No extra PyObjectCell/QSBR mechanism is introduced. ZipLongestState keeps one mutex because optional slots and the active count must be updated consistently. Callback snapshots are owned; callbacks and finalizing releases occur outside locks. Atomic cycle-index and pairwise-terminal publication are retained. Independent static concurrency review found no new lock-order or callback-under-lock issue. Concurrent next calls may still interleave; performance under contention was not benchmarked. Validation For 3cb2363d7551eeb5c0aabcac0512f9284050e1bf: Normal commit hooks, rustfmt and diff checks passed. Workspace tests and all-target Clippy with -D warnings passed. Separate C-API tests (149 passed, 2 ignored) and Clippy with -D warnings passed. Release test_itertools: 137 tests run, 22 skipped, passed. Existing cycle/zip_longest threading tests: 2 passed. Full changed itertools snippet, cycle threading snippet and focused pytest wrapper: passed. Added finalizer-reentry/source-release regressions fail on the preserved pre-PR binary and pass with this revision. Existing Lib tests cover pairwise callback reentry. CPython 3.15.0 source was checked. No CPython 3.15 executable was available for this validation pass; supplemental CPython 3.12 native-next pairwise probes passed. Other platforms and hosted CI remain separate checks. Limits Cycle follows ordinary CPython source-release behavior; CPython's free-threaded build deliberately retains that source. Cached result-tuple reuse, generic tuple-conversion failure cleanup, and batched are not addressed. A separate pre-existing iterator-protocol mismatch remains: Python-defined __next__ StopIteration exceptions are normalized by PyIterReturn::from_pyresult, discarding the original exception/traceback early. This can change source-finalizer ordering relative to CPython. The same exception-identity loss reproduces before this PR. Complete lifetime equivalence is not claimed; repairing raw-versus-normalized next semantics belongs in the shared iterator protocol rather than a mutex workaround here. AI-assisted contribution by OpenAI Codex, disclosed in commit trailers.

Open Graph Description: Summary Align itertools callback state and source ownership with CPython 3.15, rebased onto main 3d0f6fc659b02733722ec658eb2be7c5a9288c68. Read accumulate's running total after source callback...

X Description: Summary Align itertools callback state and source ownership with CPython 3.15, rebased onto main 3d0f6fc659b02733722ec658eb2be7c5a9288c68. Read accumulate's running total after source call...

Opengraph URL: https://github.com/RustPython/RustPython/pull/9721

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:a803975b-6eae-088b-c6b2-490d55ef569c
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE8F8:CC1A4:39B99EC:496FDE2:6B01F7AD
html-safe-nonce0bf049288beb5b5b30ddf641a0096facf4ac4d8d83a48b4b8a9c1a1b9fc0ffd8
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOEY4OkNDMUE0OjM5Qjk5RUM6NDk2RkRFMjo2QjAxRjdBRCIsInZpc2l0b3JfaWQiOiI3NDgzNjQ5NTc0OTYwMjMyMzY1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac061ac2064a43ca40a526e664c03465052f66b3e2d9dde771f5db4a1d65964f88
hovercard-subject-tagpull_request:5161633660
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/RustPython/RustPython/pull/9721/files
twitter:imagehttps://avatars.githubusercontent.com/u/336763669?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/336763669?s=400&v=4
og:image:altSummary Align itertools callback state and source ownership with CPython 3.15, rebased onto main 3d0f6fc659b02733722ec658eb2be7c5a9288c68. Read accumulate's running total after source callback...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git
octolytics-dimension-user_id39710557
octolytics-dimension-user_loginRustPython
octolytics-dimension-repository_id135201145
octolytics-dimension-repository_nwoRustPython/RustPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id135201145
octolytics-dimension-repository_network_root_nwoRustPython/RustPython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/RustPython/RustPython/pull/9721/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F9721%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F9721%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=RustPython%2FRustPython
Reloadhttps://github.com/RustPython/RustPython/pull/9721/files
Reloadhttps://github.com/RustPython/RustPython/pull/9721/files
Reloadhttps://github.com/RustPython/RustPython/pull/9721/files
RustPythonhttps://github.com/RustPython
RustPythonhttps://github.com/RustPython/RustPython
Codehttps://github.com/RustPython/RustPython
Issues195 (195)https://github.com/RustPython/RustPython/issues
Pull requests133 (133)https://github.com/RustPython/RustPython/pulls
Discussionshttps://github.com/RustPython/RustPython/discussions
Actionshttps://github.com/RustPython/RustPython/actions
Projectshttps://github.com/RustPython/RustPython/projects
Wikihttps://github.com/RustPython/RustPython/wiki
Security and qualityhttps://github.com/RustPython/RustPython/security
Insightshttps://github.com/RustPython/RustPython/insights
Sign up for GitHub https://github.com/signup?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
youknowonehttps://github.com/youknowone
RustPython:mainhttps://github.com/RustPython/RustPython/tree/main
youknowdot:fix/itertools-lifecycle-controls-20261104https://github.com/youknowdot/RustPython/tree/fix/itertools-lifecycle-controls-20261104
Conversation 3 https://github.com/RustPython/RustPython/pull/9721
Commits 5 https://github.com/RustPython/RustPython/pull/9721/commits
Checks 19 https://github.com/RustPython/RustPython/pull/9721/checks
Files changed https://github.com/RustPython/RustPython/pull/9721/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9721/files
Align itertools source and callback lifetimes https://github.com/RustPython/RustPython/pull/9721/files#top
Show all changes 5 commits https://github.com/RustPython/RustPython/pull/9721/files
7b0e63e Align itertools source and callback lifetimes youknowdot Nov 4, 2026 https://github.com/RustPython/RustPython/pull/9721/commits/7b0e63eddc21727996ab2b617fd9d3645f9cc2a1
36325cc Rely on scope cleanup for redundant explicit drops codex Nov 6, 2026 https://github.com/RustPython/RustPython/pull/9721/commits/36325cc303853b1f2807ccceea06d6ee4d931acf
42df7e5 Simplify tail expressions after scope cleanup codex Nov 6, 2026 https://github.com/RustPython/RustPython/pull/9721/commits/42df7e5420fb67cc946a4190e4f36d87a3e66120
5419cb9 Reuse itertools state locks for detachable sources codex Nov 7, 2026 https://github.com/RustPython/RustPython/pull/9721/commits/5419cb9cf9f01fcd5d83e6b913b09b2c636c22ca
3cb2363 Isolate pairwise finalizer probes from traceback ownership codex Nov 7, 2026 https://github.com/RustPython/RustPython/pull/9721/commits/3cb2363d7551eeb5c0aabcac0512f9284050e1bf
Clear filters https://github.com/RustPython/RustPython/pull/9721/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9721/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9721/files
itertools.rs https://github.com/RustPython/RustPython/pull/9721/files#diff-327f924a0e1982a4aa3d49157129811604b589ade7716766a67653a16e0bf101
stdlib_itertools.py https://github.com/RustPython/RustPython/pull/9721/files#diff-4e7aac46413819169f405d74449119f5a3fb6ac758d7ad63a4841cc468b53ac3
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9721/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9721/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.