mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
Issue #17225: JSON decoder now counts columns in the first line starting
with 1, as in other lines.
This commit is contained in:
parent
a2964b3175
commit
c510a048ba
5 changed files with 7 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue