Skip to content

Improve error message of compression.zstd.ZstdError #153621

Description

@smiRaphi

Feature or enhancement

Proposal:

When the underlying libzstd of compression.zstd encounters an error, compression.zstd only raises a vague "Unable to decompress Zstandard data: Data corruption detected" while libzstd is way more verbose about what actually went wrong, my proposal is to either raise a more descriptive error or expose the raw return code in ZstdError.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. picnixz commented on Jul 12, 2026

    @picnixz
    Member

    It is a bit more delicate to change an API that was already decided by a PEP but adding an attribute to exceptions with the error code may be relevant.

    cc @emmatyping

  2. smiRaphi commented on Jul 12, 2026

    @smiRaphi
    Author

    I'm not talking about changing the exception class name, just making the Message more descriptive

  3. picnixz commented on Jul 12, 2026

    @picnixz
    Member

    If it is just about the message it is fine! I did so for curses.

  4. changed the title [-]Raise exact error in compression.zstd.ZstdError[/-] [+]Improve error message of `compression.zstd.ZstdError`[/+] on Jul 12, 2026
  5. emmatyping commented on Jul 13, 2026

    @emmatyping
    Member

    Agreed it would be better to raise with a more descriptive message. @smiRaphi would you like to open a PR?

  6. added a commit that references this issue on Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions