[issue19361] Specialize exceptions thrown by JSON parser

2015-01-26 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue19361] Specialize exceptions thrown by JSON parser

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 07af9847dbec by Serhiy Storchaka in branch 'default':
Issue #19361: JSON decoder now raises JSONDecodeError instead of ValueError.
https://hg.python.org/cpython/rev/07af9847dbec

--
nosy: +python-dev

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



[issue19361] Specialize exceptions thrown by JSON parser

2014-12-02 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue19361] Specialize exceptions thrown by JSON parser

2014-11-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Updated patch provides JSONDecodeError without end* attributes and with changed 
message for Extra data.

--
Added file: http://bugs.python.org/file37328/json_JSONDecodeError_2.patch

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



[issue19361] Specialize exceptions thrown by JSON parser

2014-11-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

While we here may be change error messages?

The only error which contains end position is Extra data. And it doesn't look 
clean to me why end position should be mentioned at all (it is always len(data) 
here). I suggest to drop it, this will make error message cleaner and 
JSONDecodeError simpler.

May be mention line and column in error message only if JSON data is multiline? 
Most machine generated data has one line only. Instead of Expecting ',' 
delimiter: line 1 column 123 (char 124) I suggest Expecting ',' delimiter at 
position 124. Same as in re.error.

--

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



[issue19361] Specialize exceptions thrown by JSON parser

2014-10-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch which adopts JSONDecodeError from simplejson.

Unlike to simplejson it is located in the json.decoder module (json uses 
different way to pass an error from scanner to decoder).

--
assignee:  - serhiy.storchaka
keywords: +needs review
stage:  - patch review
versions: +Python 3.5 -Python 3.4

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



[issue19361] Specialize exceptions thrown by JSON parser

2014-10-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file36810/json_JSONDecodeError.patch

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



[issue19361] Specialize exceptions thrown by JSON parser

2014-05-22 Thread Raymond Hettinger

Raymond Hettinger added the comment:

 Adding it to the stdlib is only matter of time.

I think we can go forward with it right now.

--
nosy: +bob.ippolito

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



[issue19361] Specialize exceptions thrown by JSON parser

2014-05-22 Thread Bob Ippolito

Bob Ippolito added the comment:

simplejson v3.5.1 is probably a good target, let me know if there's anything 
that you'd like me to merge back in from stdlib to make maintenance easier. I 
haven't been tracking stdlib except when I've been added to issues.

--

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



[issue19361] Specialize exceptions thrown by JSON parser

2014-05-15 Thread Chris Rebert

Changes by Chris Rebert pyb...@rebertia.com:


--
nosy: +cvrebert

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



[issue19361] Specialize exceptions thrown by JSON parser

2013-10-23 Thread Utkarsh Upadhyay

New submission from Utkarsh Upadhyay:

The JSON parser currently throws exceptions which contain information about 
where the error happened but this information is encoded in a string and not 
available to the programmer. This leads to issues like this: 
http://stackoverflow.com/questions/19519409/how-to-get-error-location-from-json-loads-in-python

Would it be a problem if the errors thrown were specialized exceptions, e.g. 
JSONParsingError, which has ValueError as a base class with these details (line 
number, char number, etc.) exposed as public members? The changes required seem 
to be limited to changing 
http://hg.python.org/cpython/file/4c4f31a1b706/Lib/json/decoder.py and the 
related documentation.

--
components: Extension Modules
messages: 201015
nosy: musically_ut
priority: normal
severity: normal
status: open
title: Specialize exceptions thrown by JSON parser
type: enhancement

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



[issue19361] Specialize exceptions thrown by JSON parser

2013-10-23 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
components: +Library (Lib)
nosy: +ezio.melotti, pitrou, rhettinger
versions: +Python 3.4

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



[issue19361] Specialize exceptions thrown by JSON parser

2013-10-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Simplejson already have JSONDecodeError.

class JSONDecodeError(ValueError):
Subclass of ValueError with the following additional properties:

msg: The unformatted error message
doc: The JSON document being parsed
pos: The start index of doc where parsing failed
end: The end index of doc where parsing failed (may be None)
lineno: The line corresponding to pos
colno: The column corresponding to pos
endlineno: The line corresponding to end (may be None)
endcolno: The column corresponding to end (may be None)



Adding it to the stdlib is only matter of time.

--
nosy: +serhiy.storchaka

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



[issue19361] Specialize exceptions thrown by JSON parser

2013-10-23 Thread Utkarsh Upadhyay

Utkarsh Upadhyay added the comment:

Excellent!

Is there an issue for merging Simplejson into stdlib?
If so, can this issue be linked to that issue?

--

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