summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2012-06-26 07:28:32 +0400
committerBob Ippolito <bob@redivi.com>2012-06-26 07:28:32 +0400
commit16b63cdb118138f8639b6f005d92f2136c815a1e (patch)
treeee35b9b4c4be7710778d56fe831510f4941565e4
parente1919939c141bb55c18c67cf576bdb3c2fc0ab18 (diff)
downloadsimplejson-16b63cdb118138f8639b6f005d92f2136c815a1e.tar.gz
Error messages changed to match proposal for Python 3.3.1
-rw-r--r--CHANGES.txt5
-rw-r--r--conf.py6
-rw-r--r--index.rst4
-rw-r--r--setup.py2
-rw-r--r--simplejson/__init__.py2
-rw-r--r--simplejson/_speedups.c26
-rw-r--r--simplejson/decoder.py14
7 files changed, 37 insertions, 22 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index f5840cc..10cb5b9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,8 @@
+Version 2.6.0 released 2012-06-26
+
+* Error messages changed to match proposal for Python 3.3.1
+ http://bugs.python.org/issue5067
+
Version 2.5.2 released 2012-05-10
* Fix for regression introduced in 2.5.1
diff --git a/conf.py b/conf.py
index 6388def..abb3e70 100644
--- a/conf.py
+++ b/conf.py
@@ -36,15 +36,15 @@ master_doc = 'index'
# General substitutions.
project = 'simplejson'
-copyright = '2011, Bob Ippolito'
+copyright = '2012, Bob Ippolito'
# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
#
# The short X.Y version.
-version = '2.5'
+version = '2.6'
# The full version, including alpha/beta/rc tags.
-release = '2.5.2'
+release = '2.6.0'
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
diff --git a/index.rst b/index.rst
index c63f57f..cb9a0ab 100644
--- a/index.rst
+++ b/index.rst
@@ -41,7 +41,7 @@ Encoding basic Python object hierarchies::
Compact encoding::
>>> import simplejson as json
- >>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':'))
+ >>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',', ':'))
'[1,2,3,{"4":5,"6":7}]'
Pretty printing::
@@ -116,7 +116,7 @@ Using :mod:`simplejson.tool` from the shell to validate and pretty-print::
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -m simplejson.tool
- Expecting property name: line 1 column 2 (char 2)
+ Expecting property name enclosed in double quotes: line 1 column 2 (char 2)
.. highlight:: python
diff --git a/setup.py b/setup.py
index 784e97b..2629044 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ from distutils.errors import CCompilerError, DistutilsExecError, \
DistutilsPlatformError
IS_PYPY = hasattr(sys, 'pypy_translation_info')
-VERSION = '2.5.2'
+VERSION = '2.6.0'
DESCRIPTION = "Simple, fast, extensible JSON encoder/decoder for Python"
LONG_DESCRIPTION = open('README.rst', 'r').read()
diff --git a/simplejson/__init__.py b/simplejson/__init__.py
index 187f752..04a8aa6 100644
--- a/simplejson/__init__.py
+++ b/simplejson/__init__.py
@@ -97,7 +97,7 @@ Using simplejson.tool from the shell to validate and pretty-print::
$ echo '{ 1.2:3.4}' | python -m simplejson.tool
Expecting property name: line 1 column 2 (char 2)
"""
-__version__ = '2.5.2'
+__version__ = '2.6.0'
__all__ = [
'dump', 'dumps', 'load', 'loads',
'JSONDecoder', 'JSONDecodeError', 'JSONEncoder',
diff --git a/simplejson/_speedups.c b/simplejson/_speedups.c
index 92e527b..be68b2d 100644
--- a/simplejson/_speedups.c
+++ b/simplejson/_speedups.c
@@ -1058,7 +1058,9 @@ _parse_object_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_
/* read key */
if (str[idx] != '"') {
- raise_errmsg("Expecting property name", pystr, idx);
+ raise_errmsg(
+ "Expecting property name enclosed in double quotes",
+ pystr, idx);
goto bail;
}
key = scanstring_str(pystr, idx + 1, encoding, strict, &next_idx);
@@ -1079,7 +1081,7 @@ _parse_object_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_
/* skip whitespace between key and : delimiter, read :, skip whitespace */
while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
if (idx > end_idx || str[idx] != ':') {
- raise_errmsg("Expecting : delimiter", pystr, idx);
+ raise_errmsg("Expecting ':' delimiter", pystr, idx);
goto bail;
}
idx++;
@@ -1119,7 +1121,7 @@ _parse_object_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_
break;
}
else if (str[idx] != ',') {
- raise_errmsg("Expecting , delimiter", pystr, idx);
+ raise_errmsg("Expecting ',' delimiter", pystr, idx);
goto bail;
}
idx++;
@@ -1204,7 +1206,9 @@ _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ss
/* read key */
if (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);
@@ -1222,10 +1226,11 @@ _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ss
}
idx = next_idx;
- /* skip whitespace between key and : delimiter, read :, skip whitespace */
+ /* skip whitespace between key and : delimiter, read :, skip
+ whitespace */
while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
if (idx > end_idx || str[idx] != ':') {
- raise_errmsg("Expecting : delimiter", pystr, idx);
+ raise_errmsg("Expecting ':' delimiter", pystr, idx);
goto bail;
}
idx++;
@@ -1259,13 +1264,14 @@ _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ss
/* skip whitespace before } or , */
while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
- /* bail if the object is closed or we didn't get the , delimiter */
+ /* bail if the object is closed or we didn't get the ,
+ delimiter */
if (idx > end_idx) break;
if (str[idx] == '}') {
break;
}
else if (str[idx] != ',') {
- raise_errmsg("Expecting , delimiter", pystr, idx);
+ raise_errmsg("Expecting ',' delimiter", pystr, idx);
goto bail;
}
idx++;
@@ -1359,7 +1365,7 @@ _parse_array_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t
break;
}
else if (str[idx] != ',') {
- raise_errmsg("Expecting , delimiter", pystr, idx);
+ raise_errmsg("Expecting ',' delimiter", pystr, idx);
goto bail;
}
idx++;
@@ -1431,7 +1437,7 @@ _parse_array_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssi
break;
}
else if (str[idx] != ',') {
- raise_errmsg("Expecting , delimiter", pystr, idx);
+ raise_errmsg("Expecting ',' delimiter", pystr, idx);
goto bail;
}
idx++;
diff --git a/simplejson/decoder.py b/simplejson/decoder.py
index e5496d6..714a733 100644
--- a/simplejson/decoder.py
+++ b/simplejson/decoder.py
@@ -203,7 +203,9 @@ def JSONObject((s, end), encoding, strict, scan_once, object_hook,
pairs = object_hook(pairs)
return pairs, end + 1
elif nextchar != '"':
- raise JSONDecodeError("Expecting property name", s, end)
+ raise JSONDecodeError(
+ "Expecting property name enclosed in double quotes",
+ s, end)
end += 1
while True:
key, end = scanstring(s, end, encoding, strict)
@@ -214,7 +216,7 @@ def JSONObject((s, end), encoding, strict, scan_once, object_hook,
if s[end:end + 1] != ':':
end = _w(s, end).end()
if s[end:end + 1] != ':':
- raise JSONDecodeError("Expecting : delimiter", s, end)
+ raise JSONDecodeError("Expecting ':' delimiter", s, end)
end += 1
@@ -244,7 +246,7 @@ def JSONObject((s, end), encoding, strict, scan_once, object_hook,
if nextchar == '}':
break
elif nextchar != ',':
- raise JSONDecodeError("Expecting , delimiter", s, end - 1)
+ raise JSONDecodeError("Expecting ',' delimiter", s, end - 1)
try:
nextchar = s[end]
@@ -259,7 +261,9 @@ def JSONObject((s, end), encoding, strict, scan_once, object_hook,
end += 1
if nextchar != '"':
- raise JSONDecodeError("Expecting property name", s, end - 1)
+ raise JSONDecodeError(
+ "Expecting property name enclosed in double quotes",
+ s, end - 1)
if object_pairs_hook is not None:
result = object_pairs_hook(pairs)
@@ -293,7 +297,7 @@ def JSONArray((s, end), scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR):
if nextchar == ']':
break
elif nextchar != ',':
- raise JSONDecodeError("Expecting , delimiter", s, end)
+ raise JSONDecodeError("Expecting ',' delimiter", s, end)
try:
if s[end] in _ws: