Fix encoding of infinity (#80).#562
Conversation
Codecov Report
@@ Coverage Diff @@
## main #562 +/- ##
=======================================
Coverage 91.58% 91.58%
=======================================
Files 6 6
Lines 1901 1901
=======================================
Hits 1741 1741
Misses 160 160
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
JustAnotherArchivist
left a comment
There was a problem hiding this comment.
ENCODER_HELP_TEXT in python/ujson.c should probably get an s/Inf/Infinity/ as well. LGTM otherwise.
|
GitHub tip: Add something like "Fixes #80" in the PR message and it'll autoclose the issue when merged: |
Infinity was being encoded as 'Inf' which, whilst the JSON spec doesn't include any non-finite floats, differs from the conventions in other JSON libraries, JavaScript of using 'Infinity'. It also differs from what `ujson.loads()` expects so that `ujson.loads(ujson.dumps(math.inf))` raises an exception. Closes ultrajson#80.
|
Ughh, how do you put up with these precommit hooks. This one essentially reverts us back to the deprecated behaviour I was trying to fix. |
|
Yeah, if 854597d is a problem, we can remove/comment out |
|
There we go. Even precommit is happy 🙄 |
Infinity was being encoded as 'Inf' which, whilst the JSON spec doesn't include any non-finite floats, differs from the conventions in other JSON libraries, JavaScript of using 'Infinity'. It also differs from what
ujson.loads()expects so thatujson.loads(ujson.dumps(math.inf))raises an exception.