diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-21 18:19:16 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-21 18:19:16 (GMT) |
commit | c510a048ba4f17a82fff0a452bf9ccd29b51efc6 (patch) | |
tree | 5162cdafe017c4fde80b90e05adc5b4ddb295268 /Lib/json | |
parent | a2964b3175b8faba0285ccfbd269411a4893444d (diff) | |
download | cpython-c510a048ba4f17a82fff0a452bf9ccd29b51efc6.zip cpython-c510a048ba4f17a82fff0a452bf9ccd29b51efc6.tar.gz cpython-c510a048ba4f17a82fff0a452bf9ccd29b51efc6.tar.bz2 |
Issue #17225: JSON decoder now counts columns in the first line starting
with 1, as in other lines.
Diffstat (limited to 'Lib/json')
-rw-r--r-- | Lib/json/__init__.py | 2 | ||||
-rw-r--r-- | Lib/json/decoder.py | 2 | ||||
-rw-r--r-- | Lib/json/tool.py | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py index 44f49c4..48a4f8f 100644 --- a/Lib/json/__init__.py +++ b/Lib/json/__init__.py @@ -97,7 +97,7 @@ Using json.tool from the shell to validate and pretty-print:: "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool - Expecting property name enclosed in double quotes: line 1 column 2 (char 2) + Expecting property name enclosed in double quotes: line 1 column 3 (char 2) """ __version__ = '2.0.9' __all__ = [ diff --git a/Lib/json/decoder.py b/Lib/json/decoder.py index dc1155b..0c59edd 100644 --- a/Lib/json/decoder.py +++ b/Lib/json/decoder.py @@ -32,7 +32,7 @@ def linecol(doc, pos): newline = '\n' lineno = doc.count(newline, 0, pos) + 1 if lineno == 1: - colno = pos + colno = pos + 1 else: colno = pos - doc.rindex(newline, 0, pos) return lineno, colno diff --git a/Lib/json/tool.py b/Lib/json/tool.py index 0f108c6..ecf9c47 100644 --- a/Lib/json/tool.py +++ b/Lib/json/tool.py @@ -7,7 +7,7 @@ Usage:: "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool - Expecting property name enclosed in double quotes: line 1 column 2 (char 2) + Expecting property name enclosed in double quotes: line 1 column 3 (char 2) """ import sys |