Skip to content

gh-116738: Align bz2 unused_data getter to lzma implementation#144351

Merged
gpshead merged 1 commit intopython:mainfrom
yoney:ft_bz2
Apr 11, 2026
Merged

gh-116738: Align bz2 unused_data getter to lzma implementation#144351
gpshead merged 1 commit intopython:mainfrom
yoney:ft_bz2

Conversation

@yoney
Copy link
Copy Markdown
Contributor

@yoney yoney commented Jan 30, 2026

This is a follow-up to #142947 to align bz2 with lzma implementations by returning b"" from unused_data getter when eof is not set (doc). It also refactors the unused_data to make it easier to read and to clearly show that self->unused_data cannot be NULL (since PyBytes_FromStringAndSize() only fails on allocation errors).

Ran the test with tsan build.

cc: @emmatyping @colesbury

@gpshead
Copy link
Copy Markdown
Member

gpshead commented Apr 11, 2026

thanks! (skipping a news entry as this doesn't change anything meaningfully observable, only a generally implausible to code for case with a MemoryError buried in the midst to the circumstances)

@gpshead gpshead merged commit afbe137 into python:main Apr 11, 2026
53 checks passed
@gpshead gpshead added the needs backport to 3.14 bugs and security fixes label Apr 11, 2026
@miss-islington-app
Copy link
Copy Markdown

Thanks @yoney for the PR, and @gpshead for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app
Copy link
Copy Markdown

Sorry, @yoney and @gpshead, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker afbe1373ac9ac96149936211b2df71c2b6f97a4b 3.14

@gpshead gpshead removed the needs backport to 3.14 bugs and security fixes label Apr 11, 2026
@gpshead
Copy link
Copy Markdown
Member

gpshead commented Apr 11, 2026

not worrying about the backport, that was just to see if it was easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants