Commit 93f4da74 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #17225: JSON decoder now counts columns in the first line starting

with 1, as in other lines.
parent 4ad87691
...@@ -102,7 +102,7 @@ Using json.tool from the shell to validate and pretty-print:: ...@@ -102,7 +102,7 @@ Using json.tool from the shell to validate and pretty-print::
"json": "obj" "json": "obj"
} }
$ echo '{1.2:3.4}' | python -mjson.tool $ 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 .. highlight:: python3
......
...@@ -97,7 +97,7 @@ Using json.tool from the shell to validate and pretty-print:: ...@@ -97,7 +97,7 @@ Using json.tool from the shell to validate and pretty-print::
"json": "obj" "json": "obj"
} }
$ echo '{ 1.2:3.4}' | python -m json.tool $ 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' __version__ = '2.0.9'
__all__ = [ __all__ = [
......
...@@ -32,7 +32,7 @@ def linecol(doc, pos): ...@@ -32,7 +32,7 @@ def linecol(doc, pos):
newline = '\n' newline = '\n'
lineno = doc.count(newline, 0, pos) + 1 lineno = doc.count(newline, 0, pos) + 1
if lineno == 1: if lineno == 1:
colno = pos colno = pos + 1
else: else:
colno = pos - doc.rindex(newline, 0, pos) colno = pos - doc.rindex(newline, 0, pos)
return lineno, colno return lineno, colno
......
...@@ -7,7 +7,7 @@ Usage:: ...@@ -7,7 +7,7 @@ Usage::
"json": "obj" "json": "obj"
} }
$ echo '{ 1.2:3.4}' | python -m json.tool $ 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 import sys
......
...@@ -227,6 +227,9 @@ Core and Builtins ...@@ -227,6 +227,9 @@ Core and Builtins
Library 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 - Issue #13700: Fix byte/string handling in imaplib authentication when an
authobject is specified. authobject is specified.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment