Skip to content

Fix RecursionError when parsing JSON with mismatched brackets in numeric values#277

Merged
lucemia merged 3 commits into
mainfrom
claude/fix-fuzzy-json-275-CpdFU
Mar 11, 2026
Merged

Fix RecursionError when parsing JSON with mismatched brackets in numeric values#277
lucemia merged 3 commits into
mainfrom
claude/fix-fuzzy-json-275-CpdFU

Conversation

@lucemia

@lucemia lucemia commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

When a number was followed by a closing bracket that didn't match the current
stack (e.g., } when [ was on the stack), state_int/state_double/
state_exponent_digits would assert and fail. This error propagated back to
state_value_string which entered an infinite escape-retry loop causing
RecursionError. Fix by delegating mismatched bracket handling to
state_post_value which already handles inserting the missing bracket.

Fixes #275

https://claude.ai/code/session_01A8edoMzYi4cKTh5afKXDaC

claude added 3 commits March 11, 2026 16:54
…ric values

When a number was followed by a closing bracket that didn't match the current
stack (e.g., `}` when `[` was on the stack), state_int/state_double/
state_exponent_digits would assert and fail. This error propagated back to
state_value_string which entered an infinite escape-retry loop causing
RecursionError. Fix by delegating mismatched bracket handling to
state_post_value which already handles inserting the missing bracket.

Fixes #275

https://claude.ai/code/session_01A8edoMzYi4cKTh5afKXDaC
@lucemia lucemia merged commit c029778 into main Mar 11, 2026
13 checks passed
@codecov-commenter

codecov-commenter commented Mar 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.22222% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.65%. Comparing base (a24aaac) to head (57144a6).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/fuzzy_json/decoder.py 72.22% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #277      +/-   ##
==========================================
- Coverage   90.17%   88.65%   -1.52%     
==========================================
  Files           3        3              
  Lines         285      291       +6     
==========================================
+ Hits          257      258       +1     
- Misses         28       33       +5     
Flag Coverage Δ
3.10 88.65% <72.22%> (-1.52%) ⬇️
3.11 88.65% <72.22%> (-1.52%) ⬇️
3.12 88.65% <72.22%> (-1.52%) ⬇️
3.13 88.65% <72.22%> (-1.52%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lucemia lucemia deleted the claude/fix-fuzzy-json-275-CpdFU branch March 11, 2026 16:58
lucemia added a commit that referenced this pull request Mar 11, 2026
Fixes:
- RecursionError when parsing JSON with mismatched brackets (#277)
- Improved string escape logic to prevent infinite loops
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.

This example gives an exception:

3 participants