[issue37874] json traceback on a float

af report at bugs.python.org
Fri Aug 16 10:22:41 EDT 2019


New submission from af <python at afonari.com>:

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)
    352             parse_int is None and parse_float is None and
    353             parse_constant is None and object_pairs_hook is None and not kw):
--> 354         return _default_decoder.decode(s)
    355     if cls is None:
    356         cls = JSONDecoder

/scr/fonari/2019-4/internal/lib/python3.6/json/decoder.py in decode(self, s, _w)
    337 
    338         """
--> 339         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    340         end = _w(s, end).end()
    341         if end != len(s):

/scr/fonari/2019-4/internal/lib/python3.6/json/decoder.py in raw_decode(self, s, idx)
    353         """
    354         try:
--> 355             obj, end = self.scan_once(s, idx)
    356         except StopIteration as err:
    357             raise JSONDecodeError("Expecting value", s, err.value) from None

JSONDecodeError: Expecting ',' delimiter: line 1 column 3 (char 2)

Works with json.loads("[1.0e-8]") and json.loads("[1e-8]")

----------
components: Library (Lib)
messages: 349866
nosy: af
priority: normal
severity: normal
status: open
title: json traceback on a float
type: crash
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37874>
_______________________________________


More information about the Python-bugs-list mailing list