cpython: 69f793cc34fc (original) (raw)

--- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -101,7 +101,7 @@ Using json.tool from the shell to valida "json": "obj" } $ echo '{1.2:3.4}' | python -mjson.tool

.. highlight:: python3

--- a/Lib/json/init.py +++ b/Lib/json/init.py @@ -96,7 +96,7 @@ Using json.tool from the shell to valida "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool

""" version = '2.0.9' all = [

--- a/Lib/json/decoder.py +++ b/Lib/json/decoder.py @@ -24,7 +24,7 @@ def linecol(doc, pos): newline = '\n' lineno = doc.count(newline, 0, pos) + 1 if lineno == 1:

--- a/Lib/json/tool.py +++ b/Lib/json/tool.py @@ -7,7 +7,7 @@ Usage:: "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool

""" import sys

--- a/Lib/test/json_tests/test_fail.py +++ b/Lib/test/json_tests/test_fail.py @@ -125,8 +125,8 @@ class TestFail: ] for data, msg, idx in test_cases: self.assertRaisesRegex(ValueError,

def test_unexpected_data(self): @@ -155,8 +155,8 @@ class TestFail: ] for data, msg, idx in test_cases: self.assertRaisesRegex(ValueError,

def test_extra_data(self): @@ -173,10 +173,22 @@ class TestFail: for data, msg, idx in test_cases: self.assertRaisesRegex(ValueError, r'^{0}: line 1 column {1} - line 1 column {2}'

class TestPyFail(TestFail, PyTest): pass class TestCFail(TestFail, CTest): pass

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -260,6 +260,9 @@ Core and Builtins Library ------- +- Issue #17225: JSON decoder now counts columns in the first line starting