[Python-checkins] r45901 - stackless/Python-2.4.3/dev/Stackless/pickling/prickelpit.c

richard.tew python-checkins at python.org
Thu May 4 18:52:46 CEST 2006


Author: richard.tew
Date: Thu May  4 18:52:45 2006
New Revision: 45901

Modified:
   stackless/Python-2.4.3/dev/Stackless/pickling/prickelpit.c
Log:
Fix for the failing Stackless unittest TestConcretePickledTasklets.  The problem was the new dictionary iterator reduce functions I had written badly wrapped the sequence iterator (they used the iterator itself, rather than the wrapped stackless version).

Modified: stackless/Python-2.4.3/dev/Stackless/pickling/prickelpit.c
==============================================================================
--- stackless/Python-2.4.3/dev/Stackless/pickling/prickelpit.c	(original)
+++ stackless/Python-2.4.3/dev/Stackless/pickling/prickelpit.c	Thu May  4 18:52:45 2006
@@ -1415,11 +1415,11 @@
         }
     }
     /* masquerade as a PySeqIter */
-    tup = Py_BuildValue("(O(lO))",
-        &PySeqIter_Type,
-        0,
-        list
-        );
+    tup = Py_BuildValue("(O(Ol)())",
+	&wrap_PySeqIter_Type,
+	list,
+	0
+	);
     Py_DECREF(list);
     return tup;
 }
@@ -1455,11 +1455,11 @@
         }
     }
     /* masquerade as a PySeqIter */
-    tup = Py_BuildValue("(O(lO))",
-        &PySeqIter_Type,
-        0,
-        list
-        );
+    tup = Py_BuildValue("(O(Ol)())",
+	&wrap_PySeqIter_Type,
+	list,
+	0
+	);
     Py_DECREF(list);
     return tup;
 }
@@ -1502,60 +1502,15 @@
         }
     }
     /* masquerade as a PySeqIter */
-    tup = Py_BuildValue("(O(lO))",
-        &PySeqIter_Type,
-        0,
-        list
-        );
+    tup = Py_BuildValue("(O(Ol)())",
+	&wrap_PySeqIter_Type,
+	list,
+	0
+	);
     Py_DECREF(list);
     return tup;
 }
 
-#if 0
-static PyObject *
-dictiter_reduce(dictiterobject *di)
-{
-	PyObject *tup, *list, *key, *value, *res;
-	int i;
-
-	/* Make a list big enough to exhaust the dict */
-	list = PyList_New(0);
-	if (list == NULL)
-		return PyErr_NoMemory();
-
-	/* is this dictiter is already exhausted? */
-	if (di->di_dict != NULL) {
-		if (di->di_used != di->di_dict->ma_used) {
-			PyErr_SetString(PyExc_RuntimeError,
-			    "dictionary changed size during iteration");
-			di->di_used = -1; /* Make this state sticky */
-			return NULL;
-		}
-		i = di->di_pos;
-		while (PyDict_Next((PyObject *)di->di_dict, &i, &key,
-				   &value)) {
-			res = (*di->di_select)(key, value);
-			if (res == NULL) {
-				Py_DECREF(list);
-				return NULL;
-			}
-			if (PyList_Append(list, res) == -1) {
-				return NULL;
-			}
-			Py_DECREF(res);
-		}
-	}
-        /* masquerade as a PySeqIter */
-	tup = Py_BuildValue("(O(Ol)())",
-			    &wrap_PySeqIter_Type,
-			    list,
-			    0
-			    );
-	Py_DECREF(list);
-	return tup;
-}
-#endif
-
 static PyTypeObject wrap_PyDictIterKey_Type;
 
 MAKE_WRAPPERTYPE(PyDictIterKey_Type, dictiterkey, "dictionary-keyiterator",


More information about the Python-checkins mailing list