[issue37874] json traceback on a float

2019-08-16 Thread af


af  added the comment:

I understand, thanks.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37874] json traceback on a float

2019-08-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

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.

--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37874] json traceback on a float

2019-08-16 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

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 ]

  decimal-point = %x2E   ; .

  digit1-9 = %x31-39 ; 1-9

  e = %x65 / %x45; e E

  exp = e [ minus / plus ] 1*DIGIT

  frac = decimal-point 1*DIGIT

  int = zero / ( digit1-9 *DIGIT )

  minus = %x2D   ; -

  plus = %x2B; +

  zero = %x30; 0

--
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37874] json traceback on a float

2019-08-16 Thread af


Change by af :


--
type: crash -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37874] json traceback on a float

2019-08-16 Thread af


New submission from af :

json.loads traceback with:

[In [16]: json.loads("[1.e-8]")
---
JSONDecodeError   Traceback (most recent call last)
 in ()
> 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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com