1. Larry Hastings
  2. python-clinic

Commits

Serhiy Storchaka  committed 36220cf

Issue #17225: JSON decoder now counts columns in the first line starting
with 1, as in other lines.

  • Participants
  • Parent commits 0f7383e
  • Branches 3.2

Comments (0)

Files changed (5)

File Doc/library/json.rst

View file
         "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
 

File Lib/json/__init__.py

View file
         "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__ = [

File Lib/json/decoder.py

View file
         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

File Lib/json/tool.py

View file
         "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

File Misc/NEWS

View file
 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.