mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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:
commit
920007ad76
6 changed files with 25 additions and 10 deletions
|
@ -24,7 +24,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