Whole file

simplejson/simplejson

The author described this change as SJ-PT-23-100: Fix inconsistencies in error messages between C and Python implementations. It counts as a record because the check below fails on the code as it stood at 59dac4e82 and passes on dbd0aa395, with nothing else changed between the two runs.

Fix saved2023-04-04
Sharing licenceMIT · LICENSE.txt
Change size+3 2

What the code was meant to do, written into the code itself as a save note

SJ-PT-23-100: Fix inconsistencies in error messages between C and Python implementations

The change

9393 if chunk is None:
9494 raise JSONDecodeError(
9595 "Unterminated string starting at", s, begin)
96+ prev_end = end
9697 end = chunk.end()
9798 content, terminator = chunk.groups()
9899 # Content is contains zero or more unescaped string characters
107108 elif terminator != '\\':
108109 if strict:
109110 msg = "Invalid control character %r at"
110- raise JSONDecodeError(msg, s, end)
111+ raise JSONDecodeError(msg, s, prev_end)
111112 else:
112113 _append(terminator)
113114 continue
178179 return pairs, end + 1
179180 elif nextchar != '"':
180181 raise JSONDecodeError(
181- "Expecting property name enclosed in double quotes",
182+ "Expecting property name enclosed in double quotes or '}'",
182183 s, end)
183184 end += 1
184185 while True:

The check that tells the two apart

failpass·simplejson/tests/test_fail.py::TestFail::test_truncated_input

Check file simplejson/tests/test_fail.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it59dac4e82cd6766fc31a9389d573d732580eaab5
Broken version dated2023-04-04
Modulesimplejson.decoder
Units changedJSONObject, py_scanstring
Fingerprintb157ba4fd93198eb
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in simplejson/simplejson