-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-132983: _zstd: use Py_UNREACHABLE in _zstd_load_impl #137320
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as well.
@emmatyping Would you like to use your new green button?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to have a test that we don't hit this unreachable path?
Hm, how are you envisioning that? The whole point of |
I'm not a fan of needing logic like this, and it would be nice to exhaustively test that we never hit it, but I haven't had a good idea, no. A |
Anyway, the compression path already uses A |
Thanks @Rogdham for the PR, and @AA-Turner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…honGH-137320) (cherry picked from commit 57eab1b) Co-authored-by: Rogdham <3994389+Rogdham@users.noreply.github.com>
GH-137360 is a backport of this pull request to the 3.14 branch. |
There are 2 functions called
_zstd_load_impl
: one for compression and one for decompression.In these functions, the
type
variable is supposed to represent the dict type. Due to the way the function is called, the dict type is always one ofDICT_TYPE_DIGESTED
/DICT_TYPE_UNDIGESTED
/DICT_TYPE_PREFIX
. However, the implementations differs in the unreachable case:Py_UNREACHABLE
SystemError
exceptionThis PR harmonizes the two implementations by using
Py_UNREACHABLE
.