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
json traceback on a float #82055
Comments
json.loads traceback with: [In [16]: json.loads("[1.e-8]") JSONDecodeError Traceback (most recent call last)
<ipython-input-16-bf0d3d6c51c5> in <module>()
----> 1 json.loads("[1.e-8]") /scr/fonari/2019-4/internal/lib/python3.6/json/init.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) /scr/fonari/2019-4/internal/lib/python3.6/json/decoder.py in decode(self, s, _w) /scr/fonari/2019-4/internal/lib/python3.6/json/decoder.py in raw_decode(self, s, idx) JSONDecodeError: Expecting ',' delimiter: line 1 column 3 (char 2) Works with json.loads("[1.0e-8]") and json.loads("[1e-8]") |
1.0e-8 is not a format for numbers in JSON. See RFC 7159 (https://tools.ietf.org/html/rfc7159.html#section-6): number = [ minus ] int [ frac ] [ exp ]
exp = e [ minus / plus ] 1*DIGIT
frac = decimal-point 1*DIGIT
int = zero / ( digit1-9 *DIGIT )
|
I think Serhiy means 1.e-8 is not valid. The spec says that at least one digit is required in the "frac" part, after the decimal. |
I understand, thanks. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: