One function
scankey in hjson/hjson-py
The author described this change as “fix quoteless key check & error msg”. It counts as a record because the check below fails on the code as it stood at a366d23f9 and passes on c5f4848f1, with nothing else changed between the two runs.
Projecthjson/hjson-py
Fix saved2015-01-10
Sharing licenceMIT · LICENSE.txt
Change size+3 −1
What the code was meant to do, written into the code itself as a docstring
Scan the string s for a JSON/Hjson key. see scanstring
The change
| 11 | 11 | ch = s[end:end + 1] | |
| 12 | 12 | ||
| 13 | 13 | if ch == ':': | |
| 14 | + | if begin == end: | |
| 15 | + | raise JSONDecodeError("Empty key name requires quotes at", s, begin) | |
| 14 | 16 | return s[begin:end], end | |
| 15 | 17 | elif ch >= 'a' and ch <= 'z' or ch >= 'A' and ch <= 'Z' or ch >= '0' and ch <= '9': | |
| 16 | 18 | end += 1 | |
| 17 | 19 | else: | |
| 18 | - | raise JSONDecodeError("Bad name at", s, begin) | |
| 20 | + | raise JSONDecodeError("Key names that are not alphanumeric require quotes at", s, begin) |
The check that tells the two apart
fail→pass·hjson/tests/test_fail.py::TestFail::test_truncated_input
Check file hjson/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 ita366d23f9a8be41173b397e65e3613843bcc3f5f
Broken version dated2015-01-09
Modulehjson.decoder
Units changedscankey
Fingerprintb5273e428a723d3a
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 hjson/hjson-py
- 2016-02-04scanKeyName