(original) (raw)
changeset: 82302:361ba6d4b7c9 branch: 3.3 parent: 82298:a4e348c4b5d3 parent: 82301:36220cf535aa user: Serhiy Storchaka storchaka@gmail.com date: Thu Feb 21 20:21:21 2013 +0200 files: Lib/json/decoder.py Misc/NEWS description: Issue #17225: JSON decoder now counts columns in the first line starting with 1, as in other lines. diff -r a4e348c4b5d3 -r 361ba6d4b7c9 Doc/library/json.rst --- a/Doc/library/json.rst Thu Feb 21 14:34:59 2013 +0200 +++ b/Doc/library/json.rst Thu Feb 21 20:21:21 2013 +0200 @@ -102,7 +102,7 @@ "json": "obj" } $ echo '{1.2:3.4}' | python -mjson.tool - Expecting property name enclosed in double quotes: line 1 column 1 (char 1) + Expecting property name enclosed in double quotes: line 1 column 2 (char 1) .. highlight:: python3 diff -r a4e348c4b5d3 -r 361ba6d4b7c9 Lib/json/__init__.py --- a/Lib/json/__init__.py Thu Feb 21 14:34:59 2013 +0200 +++ b/Lib/json/__init__.py Thu Feb 21 20:21:21 2013 +0200 @@ -97,7 +97,7 @@ "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 -r a4e348c4b5d3 -r 361ba6d4b7c9 Lib/json/decoder.py --- a/Lib/json/decoder.py Thu Feb 21 14:34:59 2013 +0200 +++ b/Lib/json/decoder.py Thu Feb 21 20:21:21 2013 +0200 @@ -32,7 +32,7 @@ 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 -r a4e348c4b5d3 -r 361ba6d4b7c9 Lib/json/tool.py --- a/Lib/json/tool.py Thu Feb 21 14:34:59 2013 +0200 +++ b/Lib/json/tool.py Thu Feb 21 20:21:21 2013 +0200 @@ -7,7 +7,7 @@ "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 diff -r a4e348c4b5d3 -r 361ba6d4b7c9 Misc/NEWS --- a/Misc/NEWS Thu Feb 21 14:34:59 2013 +0200 +++ b/Misc/NEWS Thu Feb 21 20:21:21 2013 +0200 @@ -181,6 +181,9 @@ Library ------- +- Issue #17225: JSON decoder now counts columns in the first line starting + with 1, as in other lines. + - Issue #13700: Fix byte/string handling in imaplib authentication when an authobject is specified. /storchaka@gmail.com