Repository navigation
Conversation
This branch has not been deployed
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.
Summary
The pure-Python fallback and the C extension raise different error messages when a
map key has a type that
strict_map_keydisallows.The C extension raises:
ValueError: int is not allowed for map key when strict_map_key=TrueThe pure-Python fallback raises:
ValueError: <class 'int'> is not allowed for map keySo the message a caller sees depends on whether the C extension is available, which
makes it unreliable to log, match, or assert on. This aligns the fallback with the C
extension: it now uses
type(key).__name__instead ofstr(type(key))and includesthe same
when strict_map_key=Truesuffix, so both backends report the identical error.Changes
msgpack/fallback.py: use the same message asunpack_callback_map_iteminunpack.h, in both thedictandobject_pairs_hookmap paths.test/test_except.py: addtest_strict_map_key_error_message, which asserts themessage and runs under both the C extension and the fallback.
Notes
No behavior change beyond the message text. The full suite passes under both backends
(
MSGPACK_PUREPYTHON=1and the compiled extension).