diff -r 40eeab0f7fc2 Doc/library/json.rst --- a/Doc/library/json.rst Fri Jun 15 09:40:44 2012 +0300 +++ b/Doc/library/json.rst Fri Jun 15 12:26:46 2012 +0300 @@ -99,7 +99,7 @@ "json": "obj" } $ echo '{1.2:3.4}' | python -mjson.tool - Expecting property name: line 1 column 1 (char 1) + Expecting property name enclosed in double quotes: line 1 column 1 (char 1) .. highlight:: python3 diff -r 40eeab0f7fc2 Lib/json/__init__.py --- a/Lib/json/__init__.py Fri Jun 15 09:40:44 2012 +0300 +++ b/Lib/json/__init__.py Fri Jun 15 12:26:46 2012 +0300 @@ -97,7 +97,7 @@ "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool - Expecting property name: line 1 column 2 (char 2) + Expecting property name enclosed in double quotes: line 1 column 2 (char 2) """ __version__ = '2.0.9' __all__ = [ diff -r 40eeab0f7fc2 Lib/json/decoder.py --- a/Lib/json/decoder.py Fri Jun 15 09:40:44 2012 +0300 +++ b/Lib/json/decoder.py Fri Jun 15 12:26:46 2012 +0300 @@ -172,7 +172,8 @@ pairs = object_hook(pairs) return pairs, end + 1 elif nextchar != '"': - raise ValueError(errmsg("Expecting property name", s, end)) + raise ValueError(errmsg( + "Expecting property name enclosed in double quotes", s, end)) end += 1 while True: key, end = scanstring(s, end, strict) @@ -182,7 +183,7 @@ if s[end:end + 1] != ':': end = _w(s, end).end() if s[end:end + 1] != ':': - raise ValueError(errmsg("Expecting : delimiter", s, end)) + raise ValueError(errmsg("Expecting ':' delimiter", s, end)) end += 1 try: @@ -210,12 +211,13 @@ if nextchar == '}': break elif nextchar != ',': - raise ValueError(errmsg("Expecting , delimiter", s, end - 1)) + raise ValueError(errmsg("Expecting ',' delimiter", s, end - 1)) end = _w(s, end).end() nextchar = s[end:end + 1] end += 1 if nextchar != '"': - raise ValueError(errmsg("Expecting property name", s, end - 1)) + raise ValueError(errmsg( + "Expecting property name enclosed in double quotes", s, end - 1)) if object_pairs_hook is not None: result = object_pairs_hook(pairs) return result, end @@ -249,7 +251,7 @@ if nextchar == ']': break elif nextchar != ',': - raise ValueError(errmsg("Expecting , delimiter", s, end)) + raise ValueError(errmsg("Expecting ',' delimiter", s, end)) try: if s[end] in _ws: end += 1 diff -r 40eeab0f7fc2 Lib/json/tool.py --- a/Lib/json/tool.py Fri Jun 15 09:40:44 2012 +0300 +++ b/Lib/json/tool.py Fri Jun 15 12:26:46 2012 +0300 @@ -7,7 +7,7 @@ "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool - Expecting property name: line 1 column 2 (char 2) + Expecting property name enclosed in double quotes: line 1 column 2 (char 2) """ import sys diff -r 40eeab0f7fc2 Modules/_json.c --- a/Modules/_json.c Fri Jun 15 09:40:44 2012 +0300 +++ b/Modules/_json.c Fri Jun 15 12:26:46 2012 +0300 @@ -646,7 +646,7 @@ /* read key */ if (PyUnicode_READ(kind, str, idx) != '"') { - raise_errmsg("Expecting property name", pystr, idx); + raise_errmsg("Expecting property name enclosed in double quotes", pystr, idx); goto bail; } key = scanstring_unicode(pystr, idx + 1, strict, &next_idx); @@ -667,7 +667,7 @@ /* skip whitespace between key and : delimiter, read :, skip whitespace */ while (idx <= end_idx && IS_WHITESPACE(PyUnicode_READ(kind, str, idx))) idx++; if (idx > end_idx || PyUnicode_READ(kind, str, idx) != ':') { - raise_errmsg("Expecting : delimiter", pystr, idx); + raise_errmsg("Expecting ':' delimiter", pystr, idx); goto bail; } idx++; @@ -707,7 +707,7 @@ break; } else if (PyUnicode_READ(kind, str, idx) != ',') { - raise_errmsg("Expecting , delimiter", pystr, idx); + raise_errmsg("Expecting ',' delimiter", pystr, idx); goto bail; } idx++; @@ -797,7 +797,7 @@ break; } else if (PyUnicode_READ(kind, str, idx) != ',') { - raise_errmsg("Expecting , delimiter", pystr, idx); + raise_errmsg("Expecting ',' delimiter", pystr, idx); goto bail; } idx++;