Issue #17225: JSON decoder now counts columns in the first line starting
with 1, as in other lines.
diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py
index d6a45d3..0be85da 100644
--- a/Lib/json/__init__.py
+++ b/Lib/json/__init__.py
@@ -95,7 +95,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 --git a/Lib/json/decoder.py b/Lib/json/decoder.py
index 7e2c68c..dc8916c 100644
--- a/Lib/json/decoder.py
+++ b/Lib/json/decoder.py
@@ -27,7 +27,7 @@
def linecol(doc, pos):
lineno = doc.count('\n', 0, pos) + 1
if lineno == 1:
- colno = pos
+ colno = pos + 1
else:
colno = pos - doc.rindex('\n', 0, pos)
return lineno, colno
diff --git a/Lib/json/tool.py b/Lib/json/tool.py
index fe47c52..fc5d749 100644
--- a/Lib/json/tool.py
+++ b/Lib/json/tool.py
@@ -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