Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Positive infinity with an explicit plus is not parsed correctly #63

Closed
pavel-kirienko opened this issue Jan 14, 2023 · 2 comments
Closed

Comments

@pavel-kirienko
Copy link

>>> import json5  # v0.9.11

>>> json5.loads('Infinity')  # Correct.
inf

>>> json5.loads('-Infinity')  # Correct.
-inf

>>> json5.loads('+123.456')  # Correct.
123.456

>>> json5.loads('+Infinity')  # Non-spec behavior, incorrect; expected inf.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/.local/lib/python3.10/site-packages/json5/lib.py", line 81, in loads
    raise ValueError(err)
ValueError: <string>:1 Unexpected "I" at column 2
<string>:1 Unexpected "I" at column 2
@dpranke
Copy link
Owner

dpranke commented Apr 23, 2023

Hi! Thanks for reporting this and I apologize for the delay in getting back to you. I will try get to this soon.

dpranke added a commit that referenced this issue May 15, 2023
The code handled `Infinity` and `-Infinity` but not `+Infinity`.
This change fixes that so all three are handled.
@dpranke
Copy link
Owner

dpranke commented May 15, 2023

Fixed in ff2a072.

Thanks again for filing the bug and sorry again for me not getting to it before now.

@dpranke dpranke closed this as completed May 15, 2023
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

No branches or pull requests

2 participants