diff options
author | Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp> | 2008-11-04 00:31:31 (GMT) |
---|---|---|
committer | Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp> | 2008-11-04 00:31:31 (GMT) |
commit | 1543a22d8645c304d39d471333e18ac31fec4c6f (patch) | |
tree | fa06a51f0716694271c0d3bf0b2bc6584b8bd394 /Modules | |
parent | c1de4ccad7907939b78c8e9e7de248d20c7840ee (diff) | |
download | cpython-1543a22d8645c304d39d471333e18ac31fec4c6f.zip cpython-1543a22d8645c304d39d471333e18ac31fec4c6f.tar.gz cpython-1543a22d8645c304d39d471333e18ac31fec4c6f.tar.bz2 |
Blocked revisions 67002 via svnmerge
........
r67002 | hirokazu.yamamoto | 2008-10-23 09:37:33 +0900 | 1 line
Issue #4183: Some tests didn't run with pickle.HIGHEST_PROTOCOL.
........
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_pickle.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c index a689c33..b0686af 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -1963,7 +1963,6 @@ 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; @@ -1971,13 +1970,6 @@ 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; @@ -2154,6 +2146,7 @@ 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; @@ -2332,6 +2325,13 @@ 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) { |