summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2003-02-13 21:03:57 (GMT)
committerTim Peters <tim.peters@gmail.com>2003-02-13 21:03:57 (GMT)
commit5aa3da649554f155dd0c82bfdcc92b1577c6935d (patch)
tree2eaf7f88ff07c0597620a0d0055d2f499a7d438b /Modules
parent18e36f4576c449e55d4f6d4ca48d0803861f2f61 (diff)
downloadcpython-5aa3da649554f155dd0c82bfdcc92b1577c6935d.zip
cpython-5aa3da649554f155dd0c82bfdcc92b1577c6935d.tar.gz
cpython-5aa3da649554f155dd0c82bfdcc92b1577c6935d.tar.bz2
save(): Reformat tail end just for clarity.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/cPickle.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 6601290..c131e9e 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -2455,9 +2455,10 @@ save(Picklerobject *self, PyObject *args, int pers_save)
goto finally;
}
- if ((__reduce__ = PyDict_GetItem(dispatch_table, (PyObject *)type))) {
+ assert(t == NULL); /* just a reminder */
+ __reduce__ = PyDict_GetItem(dispatch_table, (PyObject *)type);
+ if (__reduce__ != NULL) {
Py_INCREF(__reduce__);
-
Py_INCREF(args);
ARG_TUP(self, args);
if (self->arg) {
@@ -2467,16 +2468,14 @@ save(Picklerobject *self, PyObject *args, int pers_save)
if (! t) goto finally;
}
else {
- PyErr_Clear();
-
- if ((__reduce__ = PyObject_GetAttr(args, __reduce___str))) {
+ __reduce__ = PyObject_GetAttr(args, __reduce___str);
+ if (__reduce__ == NULL)
+ PyErr_Clear();
+ else {
t = PyObject_Call(__reduce__, empty_tuple, NULL);
if (!t)
goto finally;
}
- else {
- PyErr_Clear();
- }
}
if (t) {
@@ -2486,21 +2485,22 @@ save(Picklerobject *self, PyObject *args, int pers_save)
}
if (!PyTuple_Check(t)) {
- cPickle_ErrFormat(PicklingError, "Value returned by %s must "
- "be a tuple", "O", __reduce__);
+ cPickle_ErrFormat(PicklingError, "Value returned by "
+ "%s must be a tuple",
+ "O", __reduce__);
goto finally;
}
size = PyTuple_Size(t);
- if ((size != 3) && (size != 2)) {
- cPickle_ErrFormat(PicklingError, "tuple returned by %s must "
- "contain only two or three elements", "O", __reduce__);
+ if (size != 3 && size != 2) {
+ cPickle_ErrFormat(PicklingError, "tuple returned by "
+ "%s must contain only two or three elements",
+ "O", __reduce__);
goto finally;
}
callable = PyTuple_GET_ITEM(t, 0);
-
arg_tup = PyTuple_GET_ITEM(t, 1);
if (size > 2) {
@@ -2510,8 +2510,9 @@ save(Picklerobject *self, PyObject *args, int pers_save)
}
if (!( PyTuple_Check(arg_tup) || arg_tup==Py_None )) {
- cPickle_ErrFormat(PicklingError, "Second element of tuple "
- "returned by %s must be a tuple", "O", __reduce__);
+ cPickle_ErrFormat(PicklingError, "Second element of "
+ "tuple returned by %s must be a tuple",
+ "O", __reduce__);
goto finally;
}