]> granicus.if.org Git - python/commitdiff
Issue #17225: JSON decoder now counts columns in the first line starting
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 21 Feb 2013 18:19:16 +0000 (20:19 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 21 Feb 2013 18:19:16 +0000 (20:19 +0200)
with 1, as in other lines.

Doc/library/json.rst
Lib/json/__init__.py
Lib/json/decoder.py
Lib/json/tool.py
Misc/NEWS

index bdb6436e98d572b86f90eddb86a831b851a97838..f98e0ef603f7d5644f7cb5646d1edc1d6070b103 100644 (file)
@@ -102,7 +102,7 @@ Using json.tool from the shell to validate and pretty-print::
         "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
 
index 44f49c4247fab80814ceee00dbf5f4274f9b6f32..48a4f8f863e44f4fba7f5bc600ca418291972b9f 100644 (file)
@@ -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__ = [
index dc1155b1cc76b4fef0e8c89a2004d6443784d0fc..0c59edd6baace234050f4e20612f1b11356be019 100644 (file)
@@ -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
index 0f108c6dae4bcf48d69629f166cf6cdd39b64f50..ecf9c478850279776967c05cd040d1142e649eb2 100644 (file)
@@ -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
index 8cc7f5074f7aef29fcd14571396ff996b9d3ec01..401228efc5c05327a6fbb1b1687770b2d166f87e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -227,6 +227,9 @@ Core and Builtins
 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.