Skip to content

fix(ujson.loads): raises a JSONDecodeError instead of SystemError when parsing a nested json string#667

Merged
bwoodsend merged 4 commits into
ultrajson:mainfrom
grandnew:main
May 9, 2025
Merged

fix(ujson.loads): raises a JSONDecodeError instead of SystemError when parsing a nested json string#667
bwoodsend merged 4 commits into
ultrajson:mainfrom
grandnew:main

Conversation

@grandnew

@grandnew grandnew commented May 7, 2025

Copy link
Copy Markdown
Contributor

Fixes #656

Changes proposed in this pull request:

  • add check when adding key
  • raises a JSONDecodeError instead of SystemError when parsing a nested json string

@hugovk hugovk added the changelog: Fixed For any bug fixes label May 7, 2025
@hugovk

hugovk commented May 7, 2025

Copy link
Copy Markdown
Member

Thanks for the PR, please could you add tests that check that the exception raised is a JSONDecodeError and also a subclass of ValueError?

https://docs.python.org/3/library/json.html#json.JSONDecodeError

@grandnew

grandnew commented May 7, 2025

Copy link
Copy Markdown
Contributor Author

@hugovk Hi, I've added the tests.

@bwoodsend

Copy link
Copy Markdown
Collaborator

We'll need to be really careful that we're clearing up objects properly. Every time we've done anything error catching related, we've ended up with memory leaks.

@bwoodsend

Copy link
Copy Markdown
Collaborator

I've given it a shot locally. I don't see any signs of a leak.

@bwoodsend bwoodsend merged commit 7bb3b90 into ultrajson:main May 9, 2025
@bwoodsend

Copy link
Copy Markdown
Collaborator

Shall we hit the release button? We've got this and Windows ARM64 in the queue.

@hugovk

hugovk commented May 10, 2025

Copy link
Copy Markdown
Member

Let's wait a few days, cibuildwheel should have 3.14 beta support soon: pypa/cibuildwheel#2047 (comment)

In the meantime, here's a PR to test 3.14: #668

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: Fixed For any bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ultrajson raise SystemError during parsing

3 participants