diff options
author | Bob Ippolito <bob@redivi.com> | 2013-01-01 13:37:34 -0800 |
---|---|---|
committer | Bob Ippolito <bob@redivi.com> | 2013-01-01 13:37:34 -0800 |
commit | ed84084a51367a4731f80794b062f54365ac9c59 (patch) | |
tree | e1c9516a3c1df2b76ae08063853e04e7130f976d | |
parent | 03396cb26b6165814150461ec9f49343c151d862 (diff) | |
download | simplejson-ed84084a51367a4731f80794b062f54365ac9c59.tar.gz |
bump to 3.0.2, fix Py_EnterRecusiveCall/Py_LeaveRecursiveCall balance from 3.0.1v3.0.2
-rw-r--r-- | CHANGES.txt | 5 | ||||
-rw-r--r-- | conf.py | 2 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | simplejson/__init__.py | 2 | ||||
-rw-r--r-- | simplejson/_speedups.c | 16 |
5 files changed, 20 insertions, 7 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 500252b..e65b385 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,8 @@ +Version 3.0.2 released 2013-01-01 + +* Missed a changeset to _speedups.c in the 3.0.1 branch cut, please + DO NOT install 3.0.1! + Version 3.0.1 released 2013-01-01 * Add accumulator optimization to encoder, equivalent to the usage of @@ -44,7 +44,7 @@ copyright = '2012, Bob Ippolito' # The short X.Y version. version = '3.0' # The full version, including alpha/beta/rc tags. -release = '3.0.1' +release = '3.0.2' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: @@ -7,7 +7,7 @@ from distutils.errors import CCompilerError, DistutilsExecError, \ DistutilsPlatformError IS_PYPY = hasattr(sys, 'pypy_translation_info') -VERSION = '3.0.1' +VERSION = '3.0.2' 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 84fea33..647a770 100644 --- a/simplejson/__init__.py +++ b/simplejson/__init__.py @@ -99,7 +99,7 @@ Using simplejson.tool from the shell to validate and pretty-print:: Expecting property name: line 1 column 2 (char 2) """ from __future__ import absolute_import -__version__ = '3.0.1' +__version__ = '3.0.2' __all__ = [ 'dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONDecodeError', 'JSONEncoder', diff --git a/simplejson/_speedups.c b/simplejson/_speedups.c index beceeb7..c20243b 100644 --- a/simplejson/_speedups.c +++ b/simplejson/_speedups.c @@ -2312,7 +2312,6 @@ scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_ /* Didn't find a string, object, array, or named constant. Look for a number. */ if (fallthrough) rval = _match_number_unicode(s, pystr, idx, next_idx_ptr); - Py_LeaveRecursiveCall(); return rval; } @@ -2717,8 +2716,6 @@ encoder_listencode_obj(PyEncoderObject *s, JSON_Accu *rval, PyObject *obj, Py_ss { /* Encode Python object obj to a JSON term, rval is a PyList */ int rv = -1; - if (Py_EnterRecursiveCall(" while encoding a JSON document")) - return rv; do { if (obj == Py_None || obj == Py_True || obj == Py_False) { PyObject *cstr = _encoded_const(obj); @@ -2748,17 +2745,26 @@ encoder_listencode_obj(PyEncoderObject *s, JSON_Accu *rval, PyObject *obj, Py_ss rv = _steal_accumulate(rval, encoded); } else if (s->namedtuple_as_object && _is_namedtuple(obj)) { + if (Py_EnterRecursiveCall(" while encoding a JSON object")) + return rv; PyObject *newobj = PyObject_CallMethod(obj, "_asdict", NULL); if (newobj != NULL) { rv = encoder_listencode_dict(s, rval, newobj, indent_level); Py_DECREF(newobj); } + Py_LeaveRecursiveCall(); } else if (PyList_Check(obj) || (s->tuple_as_array && PyTuple_Check(obj))) { + if (Py_EnterRecursiveCall(" while encoding a JSON object")) + return rv; rv = encoder_listencode_list(s, rval, obj, indent_level); + Py_LeaveRecursiveCall(); } else if (PyDict_Check(obj)) { + if (Py_EnterRecursiveCall(" while encoding a JSON object")) + return rv; rv = encoder_listencode_dict(s, rval, obj, indent_level); + Py_LeaveRecursiveCall(); } else if (s->use_decimal && PyObject_TypeCheck(obj, (PyTypeObject *)s->Decimal)) { PyObject *encoded = PyObject_Str(obj); @@ -2785,12 +2791,15 @@ encoder_listencode_obj(PyEncoderObject *s, JSON_Accu *rval, PyObject *obj, Py_ss break; } } + if (Py_EnterRecursiveCall(" while encoding a JSON object")) + return rv; newobj = PyObject_CallFunctionObjArgs(s->defaultfn, obj, NULL); if (newobj == NULL) { Py_XDECREF(ident); break; } rv = encoder_listencode_obj(s, rval, newobj, indent_level); + Py_LeaveRecursiveCall(); Py_DECREF(newobj); if (rv) { Py_XDECREF(ident); @@ -2805,7 +2814,6 @@ encoder_listencode_obj(PyEncoderObject *s, JSON_Accu *rval, PyObject *obj, Py_ss } } } while (0); - Py_LeaveRecursiveCall(); return rv; } |