Ferdinand Beyer added the comment:
Line and column number are included in the formatted error message (raise
ValueError(errormsg(...))). They are currently not accessible separately as
exception arguments.
--
___
Python tracker
Serhiy Storchaka added the comment:
These values used only in the exception message. However current (3.0.8, stdlib
json based on 2.0.9) simplejson exposes them as an exception attributes.
http://simplejson.readthedocs.org/en/latest/#exceptions
--
Bob Ippolito added the comment:
I've applied a very similar patch to simplejson and released 3.0.9
https://github.com/simplejson/simplejson/commit/44d7709a31f3a19f3d465411585ebb7be7fa2295
--
nosy: +bob.ippolito
___
Python tracker
Serhiy Storchaka added the comment:
https://github.com/simplejson/simplejson/issues/57
Simplejson has fixed this for about 6 hours.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17225
Roundup Robot added the comment:
New changeset ce583eb0bec2 by Serhiy Storchaka in branch '2.7':
Issue #17225: JSON decoder now counts columns in the first line starting
http://hg.python.org/cpython/rev/ce583eb0bec2
New changeset 36220cf535aa by Serhiy Storchaka in branch '3.2':
Issue #17225:
Serhiy Storchaka added the comment:
Thank you for the report, Ferdinand.
--
resolution: - fixed
stage: patch review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17225
Ezio Melotti added the comment:
Are these values accessible from somewhere (e.g. as attributes of the
exception)?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17225
___
New submission from Ferdinand Beyer:
The linecol() function in json/decoder.py computes the line and column numbers
for a byte offset in a string. Both numbers are expected to start with 1 (as
in text editors).
If the position is in the first line, the returned column is off by one (or
Changes by Serhiy Storchaka storch...@gmail.com:
--
assignee: - serhiy.storchaka
nosy: +ezio.melotti, pitrou, rhettinger, serhiy.storchaka
stage: - needs patch
versions: -Python 2.6, Python 3.1, Python 3.5
___
Python tracker rep...@bugs.python.org
Serhiy Storchaka added the comment:
Here is a patch. This change breaks tests, but unlikely anything except tests
depends on exact error message.
--
keywords: +patch
stage: needs patch - patch review
Added file: http://bugs.python.org/file29115/json_first_line_columns.patch
10 matches
Mail list logo