FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: re-raise existing exception when available by KowalskiThomas · Pull Request #667 · msgpack/msgpack-python · GitHub

fix: re-raise existing exception when available - #667

Merged
methane merged 2 commits into
msgpack:mainfrom
KowalskiThomas:kowalski/fix-re-raise-existing-exception-when-available
Apr 21, 2026
Merged

fix: re-raise existing exception when available#667
methane merged 2 commits into
msgpack:mainfrom
KowalskiThomas:kowalski/fix-re-raise-existing-exception-when-available

Conversation

KowalskiThomas commented Apr 21, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

What is this PR?

This PR addresses an issue I found while working on #666 and reported in the description there.

Looking at the usages of unpack_callback_uint32 (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,)).

It believe it should just raise to raise the existing exception set by PyErr_SetString if it exists. This PR addresses that problem here and another place.

methane commented Apr 21, 2026

Copy link
Copy Markdown
Member

Would it be easy to add a test case for this issue?

Copy link
Copy Markdown
Contributor Author

Ah yeah good point, let me have a look :)

KowalskiThomas commented Apr 21, 2026
edited
Loading

Copy link
Copy Markdown
Contributor Author

I added a test case, but I don't think it's possible to easily cover/simulate something that would happen like in #666. But the tests do flex the PyErr_Occurred path.

methane merged commit 5d465bd into msgpack:main Apr 21, 2026
26 checks passed
KowalskiThomas deleted the kowalski/fix-re-raise-existing-exception-when-available branch April 29, 2026 07:53
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL