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
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.
Activity
picnixz commented on Jul 12, 2026
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
smiRaphi commented on Jul 12, 2026
I'm not talking about changing the exception class name, just making the Message more descriptive
picnixz commented on Jul 12, 2026
If it is just about the message it is fine! I did so for curses.
emmatyping commented on Jul 13, 2026
Agreed it would be better to raise with a more descriptive message. @smiRaphi would you like to open a PR?
Add NEWS entry for pythongh-153621