diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-21 20:26:52 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-21 20:26:52 +0200 |
commit | 746e2839df9b02a7226d7fd66f1f6d8dd9622bfe (patch) | |
tree | 87a50e07d3c3218c479de386c0a0281801baa710 /Lib/json | |
parent | 5336867d6f58ad7829e72db38b05ba135226192e (diff) | |
parent | 3c131546fee8b345189ee9c545867280f1bb67a9 (diff) | |
download | cpython-746e2839df9b02a7226d7fd66f1f6d8dd9622bfe.tar.gz |
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 3b232244c3..3f95cc3bba 100644 --- a/Lib/json/__init__.py +++ b/Lib/json/__init__.py @@ -96,7 +96,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 7e5a099b5f..1b6c10b494 100644 --- a/Lib/json/decoder.py +++ b/Lib/json/decoder.py @@ -24,7 +24,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 9ab6d6546a..7db4528571 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 |