Skip to content

GH-132983: Remove subclassing support from zstd types #133694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2025

Conversation

AA-Turner
Copy link
Member

@AA-Turner AA-Turner commented May 8, 2025

cc @Rogdham

For what it's worth, bz2 and lzma's decompressor subclassing fail on creation:

>>> import bz2
>>> class D(bz2.BZ2Decompressor): pass
... 
Traceback (most recent call last):
  File "<python-input-18>", line 1, in <module>
    class D(bz2.BZ2Decompressor): pass
TypeError: type '_bz2.BZ2Decompressor' is not an acceptable base type

>>> import lzma
>>> class D(lzma.LZMADecompressor): pass
... 
Traceback (most recent call last):
  File "<python-input-19>", line 1, in <module>
    class D(lzma.LZMADecompressor): pass
TypeError: type '_lzma.LZMADecompressor' is not an acceptable base type

Copy link
Contributor

@Rogdham Rogdham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I also confirmed it works as intended.

I just noticed the case difference between zstdcompressor_type_spec and ZstdDecompressor_type_spec (and same for …_slots), but maybe it's for an other PR?

@AA-Turner
Copy link
Member Author

See #133674, which does the rename.

@AA-Turner AA-Turner enabled auto-merge (squash) May 8, 2025 18:24
@AA-Turner AA-Turner merged commit bd7c585 into python:main May 8, 2025
42 checks passed
@AA-Turner AA-Turner added the needs backport to 3.14 bugs and security fixes label May 9, 2025
@miss-islington-app
Copy link

Thanks @AA-Turner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 9, 2025
…-133694)

For consistency with ``bz2``, ``lzma``, and ``zlib``.
(cherry picked from commit bd7c585)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented May 9, 2025

GH-133762 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label May 9, 2025
AA-Turner added a commit that referenced this pull request May 9, 2025
…) (#133762)

GH-132983: Remove subclassing support from zstd types (GH-133694)

For consistency with ``bz2``, ``lzma``, and ``zlib``.
(cherry picked from commit bd7c585)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
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