summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2008-11-04 00:35:10 (GMT)
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2008-11-04 00:35:10 (GMT)
commitb46a633eaf23c43865dd25e0a38e36a4444059a0 (patch)
treefd2a8482dae7bc0a54d44e63013bd733b495eb88 /Modules
parent1543a22d8645c304d39d471333e18ac31fec4c6f (diff)
downloadcpython-b46a633eaf23c43865dd25e0a38e36a4444059a0.zip
cpython-b46a633eaf23c43865dd25e0a38e36a4444059a0.tar.gz
cpython-b46a633eaf23c43865dd25e0a38e36a4444059a0.tar.bz2
Sorry, r67092 is commit miss....
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_pickle.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index b0686af..a689c33 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -1963,6 +1963,7 @@ save_reduce(PicklerObject *self, PyObject *args, PyObject *obj)
PyObject *state = NULL;
PyObject *listitems = Py_None;
PyObject *dictitems = Py_None;
+ Py_ssize_t size;
int use_newobj = self->proto >= 2;
@@ -1970,6 +1971,13 @@ save_reduce(PicklerObject *self, PyObject *args, PyObject *obj)
const char build_op = BUILD;
const char newobj_op = NEWOBJ;
+ size = PyTuple_Size(args);
+ if (size < 2 || size > 5) {
+ PyErr_SetString(PicklingError, "tuple returned by "
+ "__reduce__ must contain 2 through 5 elements");
+ return -1;
+ }
+
if (!PyArg_UnpackTuple(args, "save_reduce", 2, 5,
&callable, &argtup, &state, &listitems, &dictitems))
return -1;
@@ -2146,7 +2154,6 @@ save(PicklerObject *self, PyObject *obj, int pers_save)
PyObject *reduce_value = NULL;
PyObject *memo_key = NULL;
int status = 0;
- Py_ssize_t size;
if (Py_EnterRecursiveCall(" while pickling an object") < 0)
return -1;
@@ -2325,13 +2332,6 @@ save(PicklerObject *self, PyObject *obj, int pers_save)
goto error;
}
- size = PyTuple_Size(reduce_value);
- if (size < 2 || size > 5) {
- PyErr_SetString(PicklingError, "tuple returned by "
- "__reduce__ must contain 2 through 5 elements");
- goto error;
- }
-
status = save_reduce(self, reduce_value, obj);
if (0) {