fix: check unpack_callback_uint32 result#666
Merged
methane merged 1 commit intomsgpack:mainfrom Apr 21, 2026
Merged
Conversation
methane
approved these changes
Apr 21, 2026
Contributor
Author
|
@methane Thank you for reviewing! Just marked the PR as Open if you want to go forward with it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Similar to #665, just a return value check to propagate the error in case one happens (instead of silently ignoring it).
Note that as opposed to the previous lines, we don't need to
PyErr_SetStringsinceunpack_callback_uint32callsPyLong_FromSize_twhich itself should set whatever Python error is relevant; we just need to make it clear to the caller that an error occurred.Note looking at the usages of the function (here for example, which calls into this) it seems like it checks for error values -2 and -3, but -1 will just
raise ValueError("Unpack failed: error = %d" % (ret,))-- I don't know if that's expected? Shouldn't it juseraiseto raise the existing exception set byPyErr_SetStringor whichever? Seems like something that should probably handled in a different PR/issue, but figured I'd raise it.