@@ -2455,9 +2455,10 @@ save(Picklerobject *self, PyObject *args, int pers_save)
24552455 goto finally ;
24562456 }
24572457
2458- if ((__reduce__ = PyDict_GetItem (dispatch_table , (PyObject * )type ))) {
2458+ assert (t == NULL ); /* just a reminder */
2459+ __reduce__ = PyDict_GetItem (dispatch_table , (PyObject * )type );
2460+ if (__reduce__ != NULL ) {
24592461 Py_INCREF (__reduce__ );
2460-
24612462 Py_INCREF (args );
24622463 ARG_TUP (self , args );
24632464 if (self -> arg ) {
@@ -2467,16 +2468,14 @@ save(Picklerobject *self, PyObject *args, int pers_save)
24672468 if (! t ) goto finally ;
24682469 }
24692470 else {
2470- PyErr_Clear ();
2471-
2472- if ((__reduce__ = PyObject_GetAttr (args , __reduce___str ))) {
2471+ __reduce__ = PyObject_GetAttr (args , __reduce___str );
2472+ if (__reduce__ == NULL )
2473+ PyErr_Clear ();
2474+ else {
24732475 t = PyObject_Call (__reduce__ , empty_tuple , NULL );
24742476 if (!t )
24752477 goto finally ;
24762478 }
2477- else {
2478- PyErr_Clear ();
2479- }
24802479 }
24812480
24822481 if (t ) {
@@ -2486,21 +2485,22 @@ save(Picklerobject *self, PyObject *args, int pers_save)
24862485 }
24872486
24882487 if (!PyTuple_Check (t )) {
2489- cPickle_ErrFormat (PicklingError , "Value returned by %s must "
2490- "be a tuple" , "O" , __reduce__ );
2488+ cPickle_ErrFormat (PicklingError , "Value returned by "
2489+ "%s must be a tuple" ,
2490+ "O" , __reduce__ );
24912491 goto finally ;
24922492 }
24932493
24942494 size = PyTuple_Size (t );
24952495
2496- if ((size != 3 ) && (size != 2 )) {
2497- cPickle_ErrFormat (PicklingError , "tuple returned by %s must "
2498- "contain only two or three elements" , "O" , __reduce__ );
2496+ if (size != 3 && size != 2 ) {
2497+ cPickle_ErrFormat (PicklingError , "tuple returned by "
2498+ "%s must contain only two or three elements" ,
2499+ "O" , __reduce__ );
24992500 goto finally ;
25002501 }
25012502
25022503 callable = PyTuple_GET_ITEM (t , 0 );
2503-
25042504 arg_tup = PyTuple_GET_ITEM (t , 1 );
25052505
25062506 if (size > 2 ) {
@@ -2510,8 +2510,9 @@ save(Picklerobject *self, PyObject *args, int pers_save)
25102510 }
25112511
25122512 if (!( PyTuple_Check (arg_tup ) || arg_tup == Py_None )) {
2513- cPickle_ErrFormat (PicklingError , "Second element of tuple "
2514- "returned by %s must be a tuple" , "O" , __reduce__ );
2513+ cPickle_ErrFormat (PicklingError , "Second element of "
2514+ "tuple returned by %s must be a tuple" ,
2515+ "O" , __reduce__ );
25152516 goto finally ;
25162517 }
25172518
0 commit comments