[Python-checkins] python/dist/src/Modules cPickle.c,2.151,2.152

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Tue Dec 7 08:06:01 CET 2004


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19035/Modules

Modified Files:
	cPickle.c 
Log Message:
Eliminate the deprecated option to return None instead of a tuple of arguments in __reduce__().

Index: cPickle.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v
retrieving revision 2.151
retrieving revision 2.152
diff -u -d -r2.151 -r2.152
--- cPickle.c	27 Jul 2004 05:22:33 -0000	2.151
+++ cPickle.c	7 Dec 2004 07:05:57 -0000	2.152
@@ -2143,6 +2143,12 @@
 				&dictitems))
 		return -1;
 
+	if (!PyTuple_Check(argtup)) {
+		PyErr_SetString(PicklingError,
+				"args from reduce() should be a tuple");
+		return -1;
+	}
+
 	if (state == Py_None)
 		state = NULL;
 	if (listitems == Py_None)
@@ -3616,17 +3622,6 @@
 		else goto err;
 	}
 
-	if (args==Py_None) {
-		/* Special case, call cls.__basicnew__() */
-		PyObject *basicnew;
-
-		basicnew = PyObject_GetAttr(cls, __basicnew___str);
-		if (!basicnew)  return NULL;
-		r=PyObject_CallObject(basicnew, NULL);
-		Py_DECREF(basicnew);
-		if (r) return r;
-	}
-
 	if ((r=PyObject_CallObject(cls, args))) return r;
 
   err:



More information about the Python-checkins mailing list