Skip to content

Return an error tuple when parsing empty input - #154

Merged
dpranke merged 1 commit into
dpranke:mainfrom
jwalith4418-Mj:fix/parse-empty-result
Nov 2, 2026
Merged

dpranke merged 1 commit into
dpranke:mainfrom
jwalith4418-Mj:fix/parse-empty-result

Conversation

@jwalith4418-Mj

Copy link
Copy Markdown
Contributor

Fixes #153.

parse('') raises ValueError despite its documented error-tuple contract. Return the error tuple for empty input instead. loads() continues raising the same ValueError through its existing error handling.

One regression checks empty text and bytes; both fail before the fix. Existing tests cover loads() rejection and other parse errors.

All 97 tests pass on Windows/Python 3.14 and Ubuntu/Python 3.10. Windows line coverage is 100%; Ruff, pylint, mypy, formatting and package builds pass. Other supported interpreters and hosted CI were not run locally.

Prepared with AI assistance. The contributor confirmed reviewing and vetting this commit before upload.

Keep loads() raising its existing ValueError while parse() follows its documented tuple-result contract for empty strings and bytes.

Prepared with AI assistance; contributor review is required before upload.
@dpranke

dpranke commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Good catch!

@dpranke
dpranke merged commit 1f4a9aa into dpranke:main Nov 2, 2026
9 checks passed
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.

parse('') raises ValueError although parse() documents it never raises

2 participants