[issue19871] json module won't parse a float that starts with a decimal point

2017-03-07 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- status: open -> pending ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:

[issue19871] json module won't parse a float that starts with a decimal point

2014-03-28 Thread Steve Holden
Steve Holden added the comment: How about: "A simple JSON decoder that converts between JSON string representations and Python data structures"? -- nosy: +holdenweb ___ Python tracker _

[issue19871] json module won't parse a float that starts with a decimal point

2014-03-24 Thread Chris Rebert
Changes by Chris Rebert : -- nosy: +cvrebert ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue19871] json module won't parse a float that starts with a decimal point

2014-02-10 Thread Antoine Pitrou
Antoine Pitrou added the comment: > - 'Simple JSON decoder.' > + 'A simple JSON decoder that splits JSON strings into JSON substrings > that represent programming objects and then converts the substrings > into Python objects.' Please let's keep the description simple. Everyone is able to unders

[issue19871] json module won't parse a float that starts with a decimal point

2014-02-10 Thread Terry J. Reedy
Terry J. Reedy added the comment: > My point is that Python and JSON are two different languages which have > different syntaxes. That is also the point of the generic note I suggested, which explains the consequence of the difference (rejection by JSON parser before calling Python constructo

[issue19871] json module won't parse a float that starts with a decimal point

2014-02-10 Thread Terry J. Reedy
Terry J. Reedy added the comment: To me, the JSONDecoder doc at the top of this section http://docs.python.org/3/library/json.html#encoders-and-decoders is unclear about decoding process and timing of application and the signature of all 5 hook functions. The timing and signature issues are rela

[issue19871] json module won't parse a float that starts with a decimal point

2014-02-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: My point is that Python and JSON are two different languages which have different syntaxes. JSON is not Python and Python is not JSON. We can't enumerate all differences unless to cite Python [1] and JSON [2] specifications. For differences from JSON specifi

[issue19871] json module won't parse a float that starts with a decimal point

2014-02-10 Thread Ezio Melotti
Ezio Melotti added the comment: I missed this comment from Serhiy: > There are too many cases where json and Python syntax differ. How many differences there are between the two? I think we might add notes to the table at http://docs.python.org/3/library/json.html#encoders-and-decoders (either

[issue19871] json module won't parse a float that starts with a decimal point

2014-01-19 Thread Vajrasky Kok
Vajrasky Kok added the comment: Attached the patch to address Ezio Melotti's concern. Thanks for the review! -- Added file: http://bugs.python.org/file33558/parse_non_valid_json_float_with_unit_test_v2.patch ___ Python tracker

[issue19871] json module won't parse a float that starts with a decimal point

2013-12-16 Thread Vajrasky Kok
Vajrasky Kok added the comment: Okay, I added unit test for this edge case. -- Added file: http://bugs.python.org/file33160/parse_non_valid_json_float_with_unit_test.patch ___ Python tracker __

[issue19871] json module won't parse a float that starts with a decimal point

2013-12-16 Thread Vajrasky Kok
Vajrasky Kok added the comment: How about this doc fix? -- keywords: +patch nosy: +vajrasky Added file: http://bugs.python.org/file33159/fix_doc_parse_non_valid_json_float.patch ___ Python tracker

[issue19871] json module won't parse a float that starts with a decimal point

2013-12-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There are too many cases where json and Python syntax differ. Final comma("[1, 2,]"), non-string keys ({1: 2}), tuples ("(1, 2)"), leading zeros ("0001"), hexadecimal integers ("0xaf"), escapes of astral characters('"\U0001d504"'), single quotes ("'spam'"),

[issue19871] json module won't parse a float that starts with a decimal point

2013-12-04 Thread Tim Peters
Tim Peters added the comment: We should adhere to the json spec, but there's no harm (and some real good!) in the docs pointing out notable cases where json and Python syntax differ. -- nosy: +tim.peters ___ Python tracker

[issue19871] json module won't parse a float that starts with a decimal point

2013-12-04 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue19871] json module won't parse a float that starts with a decimal point

2013-12-04 Thread Mark Dickinson
Mark Dickinson added the comment: > Oddly, with all of the strictness in JSON, the exponent-marker "e" > can be upper- or lower-case I'd guess that the aim is that common floating-point output formats from a variety of languages are valid JSON. That would also explain why both '+' and '-' are

[issue19871] json module won't parse a float that starts with a decimal point

2013-12-03 Thread Jesús Cea Avión
Changes by Jesús Cea Avión : -- nosy: +jcea ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python

[issue19871] json module won't parse a float that starts with a decimal point

2013-12-03 Thread Ned Batchelder
Ned Batchelder added the comment: There are other forms of numbers allowed by Python that are not allowed by JSON: "001.1" Oddly, with all of the strictness in JSON, the exponent-marker "e" can be upper- or lower-case: 1e1 and 1E1 are both valid JSON. -- nosy: +nedbat __

[issue19871] json module won't parse a float that starts with a decimal point

2013-12-03 Thread Mark Dickinson
Mark Dickinson added the comment: In context, the doc is correct: """ parse_float, if specified, will be called with the string of every JSON float to be decoded. By default, this is equivalent to float(num_str). """ IIUC, parse_float only comes into play once the JSON source has already been

[issue19871] json module won't parse a float that starts with a decimal point

2013-12-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Agree with Antoine. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue19871] json module won't parse a float that starts with a decimal point

2013-12-03 Thread Mark Dickinson
Changes by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue19871] json module won't parse a float that starts with a decimal point

2013-12-03 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue19871] json module won't parse a float that starts with a decimal point

2013-12-03 Thread Antoine Pitrou
Antoine Pitrou added the comment: I think it would be better to adhere to the JSON spec, which doesn't allow numbers to start with a decimal point: http://json.org/ If we go this way, the documentation should at least be fixed; and, as you say, we could also add a unit test for it. --

[issue19871] json module won't parse a float that starts with a decimal point

2013-12-03 Thread picomancer
New submission from picomancer: Try the following in your favorite Python version: import json json.loads(".5") On my Python (2.7.4 and 3.3.1 on Ubuntu Saucy Salamander), I get an exception. However, x = .5 is a valid Python number. With respect to the parsing of floats by the json m