René's URL Explorer Experiment


Title: Implement pyexpat character buffering and callback-safe flushes by youknowdot · Pull Request #9838 · RustPython/RustPython · GitHub

Open Graph Title: Implement pyexpat character buffering and callback-safe flushes by youknowdot · Pull Request #9838 · RustPython/RustPython

X Title: Implement pyexpat character buffering and callback-safe flushes by youknowdot · Pull Request #9838 · RustPython/RustPython

Description: Summary Implement pyexpat's Python-facing character buffering layer without changing the xml-rs dependency or manufacturing Expat-sized input chunks. Provide buffer_size and read-only buffer_used, with integer-only size validation, default capacity, same-size no-op, fallible allocation, and the documented enable/disable behavior. Accumulate character events, flushing before registered non-character callbacks and successful Parse/ParseFile completion. Flush to the old character handler before replacing it. Follow CPython 3.15.2's callback-safe ordering: detach pending data before invoking Python, release all Rust locks, and recheck handler/buffer changes after an overflow-triggered flush. Copy buffer configuration, but not pending data, to external parsers. Clear handlers and stop parsing after a callback raises. Preserve the distinct behavior of integer handler return-conversion errors, which do not perform that callback-error cleanup. Remove three expected-failure markers and add non-duplicated API/reentrancy/error regressions to the existing stdlib_pyexpat.py snippet. CPython reference CPython 3.15.2 Modules/pyexpat.c: flush_character_buffer, my_CharacterDataHandler, handler/property setters, get_parse_result, call_with_frame, and flag_error. In particular, 3.15.2 clears the used count before the callback. This matters when a callback changes the handler, buffer size, or buffering mode; the old data must not be delivered recursively. Limits intentionally retained This does not implement Expat's legacy encoding handling or streaming character-event boundaries. The iso8859/chunk-size tests and unbuffered newline-event test remain expected failures. Oversized xml-rs events are delivered whole, not arbitrarily split to make those tests pass. Existing missing error-code metadata properties also remain outside this patch. No changes to another PR's DTD implementation are included. Validation CPython 3.15.2: all newly added regression cases pass. Patched RustPython build passes. -m test test_pyexpat: 83 tests run; 16 skipped, 35 existing expected failures; no unexpected failures. Complete extra_tests/snippets/stdlib_pyexpat.py: passes. Relevant standard-library Clippy with threading and all targets: passed. Combined test_pyexpat, test_xml_etree, test_minidom, test_sax, test_pulldom, and test_plistlib: six modules successful, 714 tests run, 23 skips. Full pytest suite: 495 passed, 20 failed, 15 subtests passed (336.72s). The 20 failures match the baseline exactly: 14 host-CPython failures and 6 RustPython failures. No new failures observed. Full-workspace and C API validation were not run because of limited disk space. Implementation and investigation assisted by OpenAI Codex. CI host compatibility follow-up The first Ubuntu CI run had one failure: the host CPython 3.15.0 execution of the new reentrant-flush regression. The RustPython snippet passed. CPython 3.15.0's flush and character handler retain pending data during a callback; 3.15.2 clears it before invoking Python and rechecks buffer changes afterward. The follow-up guards only callback-mutation cases on older CPython hosts: resize, handler replacement, and overflow-triggered disable/removal. Executing those cases can recursively redeliver data or invalidate the old buffer, so guarding only the final assertions would not be safe. General exception propagation still runs everywhere; only its callback-time buffer_used == 0 assertion is version-gated. All RustPython regressions remain enabled. The final snippet was rerun successfully on actual CPython 3.15.0, CPython 3.15.2, and the previously validated RustPython binary. No Rust source changed. Upstream fix: CPython commit 0ab39af, “Handle pyexpat configuration changes during callbacks” (#160475). Summary by CodeRabbit New Features XML parsers can buffer character data with a configurable buffer size. External entity parsers inherit the parent parser’s buffering settings and handlers, but not pending text. Bug Fixes Buffer sizes now require a positive integer within the supported range; oversized text events are delivered whole. Pending character data is flushed before relevant callbacks and when buffering settings or the character-data handler change. Callback failures now end parsing and release registered handlers; subsequent parse attempts report that parsing has finished.

Open Graph Description: Summary Implement pyexpat's Python-facing character buffering layer without changing the xml-rs dependency or manufacturing Expat-sized input chunks. Provide buffer_size and read-only buffer_u...

X Description: Summary Implement pyexpat's Python-facing character buffering layer without changing the xml-rs dependency or manufacturing Expat-sized input chunks. Provide buffer_size and read-only buff...

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

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:56eedada-112c-34d7-463b-38608d8ef7ab
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC00E:1148D3:32FBABD:4117C80:6B01DE7D
html-safe-nonce9d6366ec5246feb525643ff563443ffa4c317976b3a2f57b2e561d0d8d35fafa
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDBFOjExNDhEMzozMkZCQUJEOjQxMTdDODA6NkIwMURFN0QiLCJ2aXNpdG9yX2lkIjoiNTY3NzUxNTM4MDU5MjA3NDM2NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac120c64308aff1db5b12055398c65c116efb4a5adf939a9ad1b1b0746b743d2c6
hovercard-subject-tagpull_request:5312700162
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/9838/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 Implement pyexpat's Python-facing character buffering layer without changing the xml-rs dependency or manufacturing Expat-sized input chunks. Provide buffer_size and read-only buffer_u...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/RustPython/RustPython/pull/9838/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F9838%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%2F9838%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/9838/files
Reloadhttps://github.com/RustPython/RustPython/pull/9838/files
Reloadhttps://github.com/RustPython/RustPython/pull/9838/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/pyexpat-buffering-20261114https://github.com/youknowdot/RustPython/tree/fix/pyexpat-buffering-20261114
Conversation 8 https://github.com/RustPython/RustPython/pull/9838
Commits 3 https://github.com/RustPython/RustPython/pull/9838/commits
Checks 29 https://github.com/RustPython/RustPython/pull/9838/checks
Files changed https://github.com/RustPython/RustPython/pull/9838/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9838/files
Implement pyexpat character buffering and callback-safe flushes https://github.com/RustPython/RustPython/pull/9838/files#top
Show all changes 3 commits https://github.com/RustPython/RustPython/pull/9838/files
cd700fa Implement pyexpat character buffering and callback-safe flushes codex Nov 14, 2026 https://github.com/RustPython/RustPython/pull/9838/commits/cd700faaf8805047deafd53f136049dc9addcfc8
8459df5 Guard callback-safe pyexpat regressions on older CPython hosts codex Nov 14, 2026 https://github.com/RustPython/RustPython/pull/9838/commits/8459df5e90dc0658a355ad1b0a08fd189a686ec9
b5cbc8c Route XML declaration callbacks through buffered error cleanup codex Nov 15, 2026 https://github.com/RustPython/RustPython/pull/9838/commits/b5cbc8c3bf70eea4759e0df06d75fc149f85bc47
Clear filters https://github.com/RustPython/RustPython/pull/9838/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9838/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9838/files
test_pyexpat.py https://github.com/RustPython/RustPython/pull/9838/files#diff-bdb65b60742876d0828ee1d7f2c168d36fa02cc202ace32d27c46a7b4a17605d
pyexpat.rs https://github.com/RustPython/RustPython/pull/9838/files#diff-7f4c525df38078045fcc6955c53f774ac806800c790e024f06fd3ce2b188f33b
stdlib_pyexpat.py https://github.com/RustPython/RustPython/pull/9838/files#diff-95f9b23dc92cbf099edf103303b2bcf53ee267d9ff01792010896085bc340ac2
Lib/test/test_pyexpat.pyhttps://github.com/RustPython/RustPython/pull/9838/files#diff-bdb65b60742876d0828ee1d7f2c168d36fa02cc202ace32d27c46a7b4a17605d
View file https://github.com/youknowdot/RustPython/blob/b5cbc8c3bf70eea4759e0df06d75fc149f85bc47/Lib/test/test_pyexpat.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9838/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9838/files#diff-bdb65b60742876d0828ee1d7f2c168d36fa02cc202ace32d27c46a7b4a17605d
https://github.com/RustPython/RustPython/pull/9838/files#diff-bdb65b60742876d0828ee1d7f2c168d36fa02cc202ace32d27c46a7b4a17605d
https://github.com/RustPython/RustPython/pull/9838/files#diff-bdb65b60742876d0828ee1d7f2c168d36fa02cc202ace32d27c46a7b4a17605d
https://github.com/RustPython/RustPython/pull/9838/files#diff-bdb65b60742876d0828ee1d7f2c168d36fa02cc202ace32d27c46a7b4a17605d
https://github.com/RustPython/RustPython/pull/9838/files#diff-bdb65b60742876d0828ee1d7f2c168d36fa02cc202ace32d27c46a7b4a17605d
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9838/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9838/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.