mirror of
https://github.com/python/cpython.git
synced 2025-09-24 17:33:29 +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
484dee38e6
commit
49d4022d7d
5 changed files with 7 additions and 4 deletions
|
@ -103,7 +103,7 @@ Using json.tool from the shell to validate and pretty-print::
|
||||||
"json": "obj"
|
"json": "obj"
|
||||||
}
|
}
|
||||||
$ echo '{1.2:3.4}' | python -mjson.tool
|
$ 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:: python
|
.. highlight:: python
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ Using json.tool from the shell to validate and pretty-print::
|
||||||
"json": "obj"
|
"json": "obj"
|
||||||
}
|
}
|
||||||
$ echo '{ 1.2:3.4}' | python -m json.tool
|
$ 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'
|
__version__ = '2.0.9'
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
|
|
@ -27,7 +27,7 @@ NaN, PosInf, NegInf = _floatconstants()
|
||||||
def linecol(doc, pos):
|
def linecol(doc, pos):
|
||||||
lineno = doc.count('\n', 0, pos) + 1
|
lineno = doc.count('\n', 0, pos) + 1
|
||||||
if lineno == 1:
|
if lineno == 1:
|
||||||
colno = pos
|
colno = pos + 1
|
||||||
else:
|
else:
|
||||||
colno = pos - doc.rindex('\n', 0, pos)
|
colno = pos - doc.rindex('\n', 0, pos)
|
||||||
return lineno, colno
|
return lineno, colno
|
||||||
|
|
|
@ -7,7 +7,7 @@ Usage::
|
||||||
"json": "obj"
|
"json": "obj"
|
||||||
}
|
}
|
||||||
$ echo '{ 1.2:3.4}' | python -m json.tool
|
$ 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
|
import sys
|
||||||
|
|
|
@ -208,6 +208,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #17225: JSON decoder now counts columns in the first line starting
|
||||||
|
with 1, as in other lines.
|
||||||
|
|
||||||
- Issue #7842: backported fix for py_compile.compile() syntax error handling.
|
- Issue #7842: backported fix for py_compile.compile() syntax error handling.
|
||||||
|
|
||||||
- Issue #13153: Tkinter functions now raise TclError instead of ValueError when
|
- Issue #13153: Tkinter functions now raise TclError instead of ValueError when
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue