René's URL Explorer Experiment


Title: lzma: treat empty input as a no-op, not end of stream by hyoinandout · Pull Request #8752 · RustPython/RustPython · GitHub

Open Graph Title: lzma: treat empty input as a no-op, not end of stream by hyoinandout · Pull Request #8752 · RustPython/RustPython

X Title: lzma: treat empty input as a no-op, not end of stream by hyoinandout · Pull Request #8752 · RustPython/RustPython

Description: Closes #8637 One of checkbox below must be checked. I did not use AI to write the code of this patch. This PR follows our AI policy Summary LZMADecompressor.decompress(b"") finished the decompressor instead of doing nothing. decompress_chunks returns whether the codec signalled LZMA_STREAM_END, and it short-circuits when the chunker has nothing left to feed. That early return answered "the stream ended" for the case where no input was supplied at all — an empty hand, not an empty stream. The caller latches that answer with self.eof |= stream_end, which only ever flips eof on. A single empty call therefore finished the object for good: needs_input went false and every later call was rejected by the if self.eof guard with EOFError, before a single compressed byte had been seen. import lzma blob = lzma.compress(b"data") d = lzma.LZMADecompressor() d.decompress(b"") # d.eof was True / needs_input False, now False / True d.decompress(blob) # was EOFError: End of stream already reached, now b'data' The zlib engine returns false from the identical short-circuit in compression/zlib.rs; lzma had drifted away from it, and this puts the two back in agreement. On the bz2 half of the issue: BZ2Decompressor was fixed incidentally by #8638, which moved the bz2 engine into crates/common. I confirmed current main already matches CPython there, so this PR adds only a regression test for bz2 and no behaviour change. Testing Run on macOS arm64 (aarch64-apple-darwin) against a local CPython 3.14.7. The script from the issue now prints the documented False True / b'data' for both decompressors, matching CPython exactly. Lib/test/test_lzma.py::test_decompressor_chunks_empty — this is precisely the reported scenario, and it was marked expectedFailure with this very EOFError. Marker removed. I re-checked by reverting only the one-line engine change and rebuilding: the test fails with EOFError: End of stream already reached at test_lzma.py:152, and passes with the change, so it genuinely pins the regression rather than riding along. empty_input_does_not_finish_a_stream — new engine unit test, named after the zlib test that already existed and mirrored into bz2, so all three engines stay pinned to the same behaviour instead of drifting apart again. test_lzma — 121 run, 1 skipped, SUCCESS test_bz2, test_zlib, test_gzip, test_tarfile — 1009 run, 113 skipped, SUCCESS cargo test --workspace --exclude rustpython_wasm --exclude rustpython-venvlauncher --exclude rustpython-capi — clean cargo fmt --check — clean cargo clippy -p rustpython-common --all-features --all-targets -- -D warnings — clean One note on the capi suite, which AGENTS.md also asks for: cargo test in crates/capi dies with SIGSEGV on abstract_::iter::tests::next_item. I verified it crashes identically on unmodified main (2006c63) with this change stashed, so it is pre-existing and unrelated. Not verified on Linux or Windows; the change is platform-independent control flow with no cfg-gated paths. AI disclosure Per the AI policy, this patch was written with AI assistance (Claude Code, model claude-opus-5); the commit carries an Assisted-by: trailer. I reviewed the change, and the CPython comparison, the fails-without-the-fix check, and the test and lint runs above were all executed locally on real hardware. Summary by CodeRabbit Bug Fixes Empty decompression calls no longer incorrectly mark BZ2 or LZMA streams as complete. Compressed data supplied after an empty input is now processed correctly, producing the expected output and end-of-stream status.

Open Graph Description: Closes #8637 One of checkbox below must be checked. I did not use AI to write the code of this patch. This PR follows our AI policy Summary LZMADecompressor.decompress(b"") finished ...

X Description: Closes #8637 One of checkbox below must be checked. I did not use AI to write the code of this patch. This PR follows our AI policy Summary LZMADecompressor.decompress(b"") f...

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

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:996c2877-4320-8597-babb-c23f2093f64d
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD718:DB09F:39DDB8F:49D882A:6B02086A
html-safe-nonce2a07393c80f731ddc6e49270af36c50b216d49441d364f0b193959e632dad392
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzE4OkRCMDlGOjM5RERCOEY6NDlEODgyQTo2QjAyMDg2QSIsInZpc2l0b3JfaWQiOiI4MTQ4MTIwNDE3NjgxNDEwMTU0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmace0fd5041c23349e30ef06cada1905cf3adad41db1eef0a9ab9cdf4b65e6d69e2
hovercard-subject-tagpull_request:4582799185
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/8752/files
twitter:imagehttps://avatars.githubusercontent.com/u/68385607?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/68385607?s=400&v=4
og:image:altCloses #8637 One of checkbox below must be checked. I did not use AI to write the code of this patch. This PR follows our AI policy Summary LZMADecompressor.decompress(b"") finished ...
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/8752/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F8752%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%2F8752%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/8752/files
Reloadhttps://github.com/RustPython/RustPython/pull/8752/files
Reloadhttps://github.com/RustPython/RustPython/pull/8752/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
hyoinandout:lzma-empty-input-not-eofhttps://github.com/hyoinandout/RustPython/tree/lzma-empty-input-not-eof
Conversation 5 https://github.com/RustPython/RustPython/pull/8752
Commits 1 https://github.com/RustPython/RustPython/pull/8752/commits
Checks 22 https://github.com/RustPython/RustPython/pull/8752/checks
Files changed https://github.com/RustPython/RustPython/pull/8752/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8752/files
lzma: treat empty input as a no-op, not end of stream https://github.com/RustPython/RustPython/pull/8752/files#top
Show all changes 1 commit https://github.com/RustPython/RustPython/pull/8752/files
d05ac3b lzma: treat empty input as a no-op, not end of stream hyoinandout Sep 20, 2026 https://github.com/RustPython/RustPython/pull/8752/commits/d05ac3b7ecb574a1fe96c4aa5866b8d6f3388c42
Clear filters https://github.com/RustPython/RustPython/pull/8752/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8752/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8752/files
test_lzma.py https://github.com/RustPython/RustPython/pull/8752/files#diff-c0d354f43bb17a1ab769897c04ad70a9d5364b876cde66a0fa6ebf50f7db1fb6
bz2.rs https://github.com/RustPython/RustPython/pull/8752/files#diff-8699d1221d7a94ddae08efb1c911808fe1b3678e75ccf66888d89d4e97babfa9
lzma.rs https://github.com/RustPython/RustPython/pull/8752/files#diff-83341d9b777a346e4c3fb79c3c2cb0165ca319852150f8bc3842aa4469b1f102
Lib/test/test_lzma.pyhttps://github.com/RustPython/RustPython/pull/8752/files#diff-c0d354f43bb17a1ab769897c04ad70a9d5364b876cde66a0fa6ebf50f7db1fb6
View file https://github.com/hyoinandout/RustPython/blob/d05ac3b7ecb574a1fe96c4aa5866b8d6f3388c42/Lib/test/test_lzma.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/8752/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/8752/files#diff-c0d354f43bb17a1ab769897c04ad70a9d5364b876cde66a0fa6ebf50f7db1fb6
https://github.com/RustPython/RustPython/pull/8752/files#diff-c0d354f43bb17a1ab769897c04ad70a9d5364b876cde66a0fa6ebf50f7db1fb6
crates/common/src/compression/bz2.rshttps://github.com/RustPython/RustPython/pull/8752/files#diff-8699d1221d7a94ddae08efb1c911808fe1b3678e75ccf66888d89d4e97babfa9
View file https://github.com/hyoinandout/RustPython/blob/d05ac3b7ecb574a1fe96c4aa5866b8d6f3388c42/crates/common/src/compression/bz2.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/8752/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/8752/files#diff-8699d1221d7a94ddae08efb1c911808fe1b3678e75ccf66888d89d4e97babfa9
https://github.com/RustPython/RustPython/pull/8752/files#diff-8699d1221d7a94ddae08efb1c911808fe1b3678e75ccf66888d89d4e97babfa9
crates/common/src/compression/lzma.rshttps://github.com/RustPython/RustPython/pull/8752/files#diff-83341d9b777a346e4c3fb79c3c2cb0165ca319852150f8bc3842aa4469b1f102
View file https://github.com/hyoinandout/RustPython/blob/d05ac3b7ecb574a1fe96c4aa5866b8d6f3388c42/crates/common/src/compression/lzma.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/8752/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/8752/files#diff-83341d9b777a346e4c3fb79c3c2cb0165ca319852150f8bc3842aa4469b1f102
https://github.com/RustPython/RustPython/pull/8752/files#diff-83341d9b777a346e4c3fb79c3c2cb0165ca319852150f8bc3842aa4469b1f102
https://github.com/RustPython/RustPython/pull/8752/files#diff-83341d9b777a346e4c3fb79c3c2cb0165ca319852150f8bc3842aa4469b1f102
https://github.com/RustPython/RustPython/pull/8752/files#diff-83341d9b777a346e4c3fb79c3c2cb0165ca319852150f8bc3842aa4469b1f102
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8752/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.