Skip to content

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

Closed
@pavel-kirienko

Description

@pavel-kirienko
>>> 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions