Skip to content

fix: check unpack_callback_uint32 result#666

Merged
methane merged 1 commit intomsgpack:mainfrom
KowalskiThomas:kowalski/fix-check-unpack_callback_uint32-result
Apr 21, 2026
Merged

fix: check unpack_callback_uint32 result#666
methane merged 1 commit intomsgpack:mainfrom
KowalskiThomas:kowalski/fix-check-unpack_callback_uint32-result

Conversation

@KowalskiThomas
Copy link
Copy Markdown
Contributor

@KowalskiThomas KowalskiThomas commented Apr 20, 2026

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_SetString since unpack_callback_uint32 calls PyLong_FromSize_t which 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 juse raise to raise the existing exception set by PyErr_SetString or whichever? Seems like something that should probably handled in a different PR/issue, but figured I'd raise it.

@KowalskiThomas KowalskiThomas marked this pull request as ready for review April 21, 2026 06:40
@KowalskiThomas
Copy link
Copy Markdown
Contributor Author

@methane Thank you for reviewing! Just marked the PR as Open if you want to go forward with it.

@methane methane merged commit 156bb05 into msgpack:main Apr 21, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants