Skip to content

Conversation

aylen384
Copy link
Contributor

Same as micropython's internal json lib does.

@aylen384 aylen384 force-pushed the decode branch 3 times, most recently from f89aa1c to e53ae58 Compare March 14, 2025 13:06
@@ -413,4 +413,6 @@ def loads(
kw["parse_int"] = parse_int
if parse_constant is not None:
kw["parse_constant"] = parse_constant
if isinstance(s, bytes):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CPython also supports bytearray so this could be:

if isinstance(s, (bytes, bytearray)):

Also, please also update the documentation comment for the loads function to mention that s can be str, bytes or bytearray.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for the quick response!

Same as micropython's internal json lib does.

Fixes micropython#985.

Signed-off-by: Dominik Heidler <[email protected]>
@dpgeorge dpgeorge merged commit d1a7436 into micropython:master Apr 10, 2025
4 checks passed
@aylen384 aylen384 deleted the decode branch April 10, 2025 12:48
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