summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2013-01-01 14:54:40 -0800
committerBob Ippolito <bob@redivi.com>2013-01-01 14:54:40 -0800
commit4d6b86059c981d1a275c803ecc91f511980b0af0 (patch)
treee1c9516a3c1df2b76ae08063853e04e7130f976d
parent1aa8819498321dbfc601ff8a304d0c8a901f76da (diff)
downloadsimplejson-4d6b86059c981d1a275c803ecc91f511980b0af0.tar.gz
Revert "Merge pull request #46 from cgohlke/patch-1"
This reverts commit 1aa8819498321dbfc601ff8a304d0c8a901f76da, reversing changes made to ed84084a51367a4731f80794b062f54365ac9c59.
-rw-r--r--simplejson/_speedups.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/simplejson/_speedups.c b/simplejson/_speedups.c
index fdc4062..c20243b 100644
--- a/simplejson/_speedups.c
+++ b/simplejson/_speedups.c
@@ -698,7 +698,6 @@ encoder_dict_iteritems(PyEncoderObject *s, PyObject *dct)
// item can be added as-is
}
else {
- PyObject *tpl;
kstr = encoder_stringify_key(s, key);
if (kstr == NULL)
goto bail;
@@ -710,7 +709,7 @@ encoder_dict_iteritems(PyEncoderObject *s, PyObject *dct)
value = PyTuple_GET_ITEM(item, 1);
if (value == NULL)
goto bail;
- tpl = PyTuple_Pack(2, kstr, value);
+ PyObject *tpl = PyTuple_Pack(2, kstr, value);
if (tpl == NULL)
goto bail;
Py_CLEAR(kstr);
@@ -868,7 +867,6 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict, Py_s
char *buf = PyString_AS_STRING(pystr);
PyObject *chunks = NULL;
PyObject *chunk = NULL;
- PyObject *strchunk = NULL;
if (len == end) {
raise_errmsg("Unterminated string starting at", pystr, begin);
@@ -912,7 +910,7 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict, Py_s
goto bail;
}
#else /* PY_MAJOR_VERSION >= 3 */
- strchunk = PyString_FromStringAndSize(&buf[end], next - end);
+ PyObject *strchunk = PyString_FromStringAndSize(&buf[end], next - end);
if (strchunk == NULL) {
goto bail;
}
@@ -2747,10 +2745,9 @@ 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)) {
- PyObject *newobj;
if (Py_EnterRecursiveCall(" while encoding a JSON object"))
return rv;
- newobj = PyObject_CallMethod(obj, "_asdict", NULL);
+ PyObject *newobj = PyObject_CallMethod(obj, "_asdict", NULL);
if (newobj != NULL) {
rv = encoder_listencode_dict(s, rval, newobj, indent_level);
Py_DECREF(newobj);