[Stackless] 2.5 porting issue

Richard Tew richard.m.tew at gmail.com
Mon Jul 10 22:14:48 CEST 2006


On 7/10/06, Jeff Senn wrote:
> Richard Tew wrote:
> > In the end I gave up on it and looked into another bug, which
> > indicated that my changes to the generator sending code
> > were just plain wrong.  This problem has gone away now :)
>
> Heh! Great!  I tried a build (after fixing the R31 business
> in switch_ppc_macosx.h) on OS-X -- I'm guessing
> I did this after you fixed it since I didn't see the earlier
> problem.  For me Lib/test/test_descr.py crashes with a stack
> overflow (I believe) because it fails to limit
> recursion...

This is because I disabled the relevant code in 2.5b1 when I
ported Stackless into it.  I pasted a patch of my current
changes below.

> There are a couple of other (non-crashing) test failures as well
> which I haven't looked at yet...

Some of them should be addressed in the patch as well.

Set iterators have changed and need pickling support and
there is also a generator unpickling problem, both in
the Stackless tests.  Then there are the three Python
regression tests that still fail for me.

The end is in sight I think :)

Cheers,
Richard.

Index: Objects/abstract.c
===================================================================
--- Objects/abstract.c	(revision 47225)
+++ Objects/abstract.c	(working copy)
@@ -1799,7 +1799,7 @@

 	if ((call = func->ob_type->tp_call) != NULL) {
 		PyObject *result = NULL;
-#ifdef STACKLESS
+// #ifdef STACKLESS
 		/* We disable this recursiveness because it breaks our
 		   stackless expectations, this value gets passed all
 		   the way down to where we make current the main tasklet
@@ -1807,7 +1807,7 @@
 		   schedule_task_destruct finds the recursion addition
 		   and disagrees with its presence asserting.
 		   */
-#else
+// #else
 		/* slot_tp_call() will be called and ends up calling
 		   PyObject_Call() if the object returned for __call__ has
 		   __call__ itself defined upon it.  This can be an infinite
@@ -1816,12 +1816,12 @@
 		if (Py_EnterRecursiveCall(" in __call__")) {
 		    return NULL;
 		}
-#endif
+// #endif
 		result = (STACKLESS_PROMOTE(func), (*call)(func, arg, kw));
 		STACKLESS_ASSERT();
-#ifndef STACKLESS
+//#ifndef STACKLESS
 		Py_LeaveRecursiveCall();
-#endif
+//#endif
 		if (result == NULL && !PyErr_Occurred())
 			PyErr_SetString(
 				PyExc_SystemError,
Index: Python/pythonrun.c
===================================================================
--- Python/pythonrun.c	(revision 47225)
+++ Python/pythonrun.c	(working copy)
@@ -1215,12 +1215,15 @@
 PyRun_StringFlags(const char *str, int start, PyObject *globals,
 		  PyObject *locals, PyCompilerFlags *flags)
 {
+	STACKLESS_GETARG();
 	PyObject *ret = NULL;
 	PyArena *arena = PyArena_New();
 	mod_ty mod = PyParser_ASTFromString(str, "<string>", start, flags,
 					    arena);
-	if (mod != NULL)
+	if (mod != NULL) {
+		STACKLESS_PROMOTE_ALL();
 		ret = run_mod(mod, "<string>", globals, locals, flags, arena);
+	}
 	PyArena_Free(arena);
 	return ret;
 }
Index: Stackless/module/scheduling.c
===================================================================
--- Stackless/module/scheduling.c	(revision 47229)
+++ Stackless/module/scheduling.c	(working copy)
@@ -997,8 +997,8 @@
 		ts->st.nesting_level = 0;
 	}

-	/* update what's not yet updated */
-	assert(ts->recursion_depth == 0);
+	/* update what's not yet updated
+	assert(ts->recursion_depth == 0);*/
 	prev->recursion_depth = 0;
 	assert(ts->frame == NULL);
 	prev->f.frame = NULL;
Index: Stackless/pickling/prickelpit.c
===================================================================
--- Stackless/pickling/prickelpit.c	(revision 47229)
+++ Stackless/pickling/prickelpit.c	(working copy)
@@ -1551,8 +1551,37 @@
 }
 #undef initchain
 #define initchain init_dictiteritemtype
+#if 0
+/******************************************************

+  pickling of setiter

+ ******************************************************/
+
+/* XXX make sure this copy is always up to date */
+typedef struct {
+	PyObject_HEAD
+	PySetObject *si_set; /* Set to NULL when iterator is exhausted */
+	Py_ssize_t si_used;
+	Py_ssize_t si_pos;
+	Py_ssize_t len;
+} setiterobject;
+
+
+/*
+ - Custom reduce?
+ - Custom setstate?
+ - Custom new?
+*/
+
+static PyTypeObject wrap_PySetIter_Type;
+
+MAKE_WRAPPERTYPE(wrap_PySetIter_Type, setiter, "setiterator",
+		 setiter_reduce, generic_new, generic_setstate)
+
+#undef initchain
+#define initchain init_setitertype
+#endif
 /******************************************************

   pickling of enumerate

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list