[Stackless-checkins] r47146 - in stackless/trunk: Include/Python.h Include/ceval.h Include/descrobject.h Include/frameobject.h Include/genobject.h Include/methodobject.h Include/object.h Include/pyerrors.h Include/pystate.h Lib/copy_reg.py Lib/pickle.py Makefile.pre.in Modules/Setup.dist Modules/cPickle.c Objects/abstract.c Objects/classobject.c Objects/descrobject.c Objects/exceptions.c Objects/frameobject.c Objects/funcobject.c Objects/genobject.c Objects/methodobject.c Objects/rangeobject.c Objects/typeobject.c PC/config.c PC/getpathp.c PCbuild/_bsddb.vcproj PCbuild/_ctypes.vcproj PCbuild/_ctypes_test.vcproj PCbuild/_elementtree.vcproj PCbuild/_msi.vcproj PCbuild/_socket.vcproj PCbuild/_sqlite3.vcproj PCbuild/_testcapi.vcproj PCbuild/_tkinter.vcproj PCbuild/bz2.vcproj PCbuild/compression.py PCbuild/cstack.py PCbuild/make_buildinfo.c PCbuild/mapfile.py PCbuild/mkversion.py PCbuild/psyco.vcproj PCbuild/publish_binaries.py PCbuild/pyexpat.vcproj PCbuild/python.vcproj PCbuild/pythoncore.! vcproj PCbuild/pythonw.vcproj PCbuild/schedtest.py PCbuild/select.vcproj PCbuild/unicodedata.vcproj PCbuild/uthread_ccp.py PCbuild/winsound.vcproj Python/bltinmodule.c Python/ceval.c Python/getversion.c Python/pystate.c Python/pythonrun.c Python/sysmodule.c Stackless/core/cframeobject.c Stackless/core/slp_exttype.h Stackless/core/stackless_impl.h Stackless/core/stackless_methods.h Stackless/core/stackless_tstate.h Stackless/core/stacklesseval.c Stackless/module/channelobject.c Stackless/module/scheduling.c Stackless/module/stacklessmodule.c Stackless/module/taskletobject.c Stackless/pickling/prickelpit.c Stackless/pickling/prickelpit.h Stackless/pickling/safe_pickle.c configure configure.in setup.py

richard.tew python-checkins at python.org
Wed Jun 28 15:34:50 CEST 2006


Author: richard.tew
Date: Wed Jun 28 15:34:33 2006
New Revision: 47146

Added:
   stackless/trunk/PCbuild/compression.py   (contents, props changed)
   stackless/trunk/PCbuild/cstack.py   (contents, props changed)
   stackless/trunk/PCbuild/mapfile.py   (contents, props changed)
   stackless/trunk/PCbuild/mkversion.py   (contents, props changed)
   stackless/trunk/PCbuild/psyco.vcproj   (contents, props changed)
   stackless/trunk/PCbuild/publish_binaries.py   (contents, props changed)
   stackless/trunk/PCbuild/schedtest.py   (contents, props changed)
   stackless/trunk/PCbuild/uthread_ccp.py   (contents, props changed)
Modified:
   stackless/trunk/Include/Python.h
   stackless/trunk/Include/ceval.h
   stackless/trunk/Include/descrobject.h
   stackless/trunk/Include/frameobject.h
   stackless/trunk/Include/genobject.h
   stackless/trunk/Include/methodobject.h
   stackless/trunk/Include/object.h
   stackless/trunk/Include/pyerrors.h
   stackless/trunk/Include/pystate.h
   stackless/trunk/Lib/copy_reg.py
   stackless/trunk/Lib/pickle.py
   stackless/trunk/Makefile.pre.in
   stackless/trunk/Modules/Setup.dist
   stackless/trunk/Modules/cPickle.c
   stackless/trunk/Objects/abstract.c
   stackless/trunk/Objects/classobject.c
   stackless/trunk/Objects/descrobject.c
   stackless/trunk/Objects/exceptions.c
   stackless/trunk/Objects/frameobject.c
   stackless/trunk/Objects/funcobject.c
   stackless/trunk/Objects/genobject.c
   stackless/trunk/Objects/methodobject.c
   stackless/trunk/Objects/rangeobject.c
   stackless/trunk/Objects/typeobject.c
   stackless/trunk/PC/config.c
   stackless/trunk/PC/getpathp.c
   stackless/trunk/PCbuild/_bsddb.vcproj
   stackless/trunk/PCbuild/_ctypes.vcproj
   stackless/trunk/PCbuild/_ctypes_test.vcproj
   stackless/trunk/PCbuild/_elementtree.vcproj
   stackless/trunk/PCbuild/_msi.vcproj
   stackless/trunk/PCbuild/_socket.vcproj
   stackless/trunk/PCbuild/_sqlite3.vcproj
   stackless/trunk/PCbuild/_testcapi.vcproj
   stackless/trunk/PCbuild/_tkinter.vcproj
   stackless/trunk/PCbuild/bz2.vcproj
   stackless/trunk/PCbuild/make_buildinfo.c
   stackless/trunk/PCbuild/pyexpat.vcproj
   stackless/trunk/PCbuild/python.vcproj
   stackless/trunk/PCbuild/pythoncore.vcproj
   stackless/trunk/PCbuild/pythonw.vcproj
   stackless/trunk/PCbuild/select.vcproj
   stackless/trunk/PCbuild/unicodedata.vcproj
   stackless/trunk/PCbuild/winsound.vcproj
   stackless/trunk/Python/bltinmodule.c
   stackless/trunk/Python/ceval.c
   stackless/trunk/Python/getversion.c
   stackless/trunk/Python/pystate.c
   stackless/trunk/Python/pythonrun.c
   stackless/trunk/Python/sysmodule.c
   stackless/trunk/Stackless/core/cframeobject.c
   stackless/trunk/Stackless/core/slp_exttype.h
   stackless/trunk/Stackless/core/stackless_impl.h
   stackless/trunk/Stackless/core/stackless_methods.h
   stackless/trunk/Stackless/core/stackless_tstate.h
   stackless/trunk/Stackless/core/stacklesseval.c
   stackless/trunk/Stackless/module/channelobject.c
   stackless/trunk/Stackless/module/scheduling.c
   stackless/trunk/Stackless/module/stacklessmodule.c
   stackless/trunk/Stackless/module/taskletobject.c
   stackless/trunk/Stackless/pickling/prickelpit.c
   stackless/trunk/Stackless/pickling/prickelpit.h
   stackless/trunk/Stackless/pickling/safe_pickle.c
   stackless/trunk/configure
   stackless/trunk/configure.in
   stackless/trunk/setup.py
Log:
Merging of the Stackless core changes (the difference between 2.4.3 release source code and the Stackless 2.4.3 dev source code) into the branched 2.5b1 trunk source code.

It compiles.  The interpreter starts.  But any attempt at running either the Stackless unit tests or the Python regression tests dies horribly with a "SystemError: error return without exception set" (as should be expected).  There are a lot of changes from 2.4 to 2.5 which affect Stackless, and no attempt has been made as yet to do anything bar get the source code to compile and the interpreter to run.  Notable known issues are the introduction of PyEval_EvalFrameEx, which adds a new argument to the evaluation of frames (something core to Stackless) and the new generator functions which coroutine like functionality, which have been left in place unlooked at and are guaranteed to work less than anything else.

Modified: stackless/trunk/Include/Python.h
==============================================================================
--- stackless/trunk/Include/Python.h	(original)
+++ stackless/trunk/Include/Python.h	Wed Jun 28 15:34:33 2006
@@ -75,6 +75,9 @@
 #endif
 #include "pymem.h"
 
+/* comment this out if you don't want to be stackless */
+#include "stackless.h"
+
 #include "object.h"
 #include "objimpl.h"
 

Modified: stackless/trunk/Include/ceval.h
==============================================================================
--- stackless/trunk/Include/ceval.h	(original)
+++ stackless/trunk/Include/ceval.h	Wed Jun 28 15:34:33 2006
@@ -4,7 +4,6 @@
 extern "C" {
 #endif
 
-
 /* Interface to random parts in ceval.c */
 
 PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
@@ -69,6 +68,11 @@
 PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *);
 PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc);
 
+#ifdef STACKLESS
+PyAPI_FUNC(PyObject *) PyEval_EvalFrame_slp(struct _frame *f, int exc, PyObject *retval);
+PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx_slp(struct _frame *f, int exc, PyObject *retval);
+#endif
+
 /* this used to be handled on a per-thread basis - now just two globals */
 PyAPI_DATA(volatile int) _Py_Ticker;
 PyAPI_DATA(int) _Py_CheckInterval;

Modified: stackless/trunk/Include/descrobject.h
==============================================================================
--- stackless/trunk/Include/descrobject.h	(original)
+++ stackless/trunk/Include/descrobject.h	Wed Jun 28 15:34:33 2006
@@ -30,6 +30,9 @@
 	char *doc;
 	int flags;
 	PyObject *name_strobj;
+#ifdef STACKLESS
+	int slp_offset;
+#endif
 };
 
 /* Flags for above struct */
@@ -65,6 +68,9 @@
 	PyDescr_COMMON;
 	struct wrapperbase *d_base;
 	void *d_wrapped; /* This can be any function pointer */
+#ifdef STACKLESS
+	int d_slpmask;
+#endif
 } PyWrapperDescrObject;
 
 PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type;

Modified: stackless/trunk/Include/frameobject.h
==============================================================================
--- stackless/trunk/Include/frameobject.h	(original)
+++ stackless/trunk/Include/frameobject.h	Wed Jun 28 15:34:33 2006
@@ -7,6 +7,10 @@
 extern "C" {
 #endif
 
+#ifdef STACKLESS
+typedef PyObject *(PyFrame_ExecFunc) (struct _frame *, int, PyObject *);
+#endif
+
 typedef struct {
     int b_type;			/* what kind of block this is */
     int b_handler;		/* where to jump to find handler */
@@ -16,7 +20,12 @@
 typedef struct _frame {
     PyObject_VAR_HEAD
     struct _frame *f_back;	/* previous frame, or NULL */
+#ifdef STACKLESS
+    /* support for soft stackless */
+    PyFrame_ExecFunc *f_execute;
+#else
     PyCodeObject *f_code;	/* code segment */
+#endif
     PyObject *f_builtins;	/* builtin symbol table (PyDictObject) */
     PyObject *f_globals;	/* global symbol table (PyDictObject) */
     PyObject *f_locals;		/* local symbol table (any mapping) */
@@ -43,6 +52,9 @@
     int f_lineno;		/* Current line number */
     int f_iblock;		/* index in f_blockstack */
     PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
+#ifdef STACKLESS
+    PyCodeObject *f_code;	/* code segment */
+#endif
     PyObject *f_localsplus[1];	/* locals+stack, dynamically sized */
 } PyFrameObject;
 

Modified: stackless/trunk/Include/genobject.h
==============================================================================
--- stackless/trunk/Include/genobject.h	(original)
+++ stackless/trunk/Include/genobject.h	Wed Jun 28 15:34:33 2006
@@ -29,6 +29,9 @@
 #define PyGen_CheckExact(op) ((op)->ob_type == &PyGen_Type)
 
 PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *);
+#ifdef STACKLESS
+#define PyGen_New PyGenerator_New
+#endif
 PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *);
 
 #ifdef __cplusplus

Modified: stackless/trunk/Include/methodobject.h
==============================================================================
--- stackless/trunk/Include/methodobject.h	(original)
+++ stackless/trunk/Include/methodobject.h	Wed Jun 28 15:34:33 2006
@@ -70,6 +70,12 @@
 
 #define METH_COEXIST   0x0040
 
+#ifdef STACKLESS
+#define METH_STACKLESS 0x0080
+#else
+#define METH_STACKLESS 0x0000
+#endif
+
 typedef struct PyMethodChain {
     PyMethodDef *methods;		/* Methods of this type */
     struct PyMethodChain *link;	/* NULL or base type */

Modified: stackless/trunk/Include/object.h
==============================================================================
--- stackless/trunk/Include/object.h	(original)
+++ stackless/trunk/Include/object.h	Wed Jun 28 15:34:33 2006
@@ -4,6 +4,9 @@
 extern "C" {
 #endif
 
+#ifdef STACKLESS
+#include "core/slp_exttype.h"
+#endif
 
 /* Object and type object interface */
 
@@ -342,9 +345,31 @@
 	struct _typeobject *tp_prev;
 	struct _typeobject *tp_next;
 #endif
+#ifdef STACKLESS
+	/* we need the extended structure right here */
+	PyNumberMethods as_number;
+	PyMappingMethods as_mapping;
+	PySequenceMethods as_sequence; /* as_sequence comes after as_mapping,
+					  so that the mapping wins when both
+					  the mapping and the sequence define
+					  a given operator (e.g. __getitem__).
+					  see add_operators() in typeobject.c . */
+	PyBufferProcs as_buffer;
+	PyObject *ht_name, *ht_slots;
+	slp_methodflags slpflags;
+#endif
 } PyTypeObject;
 
 
+#ifdef STACKLESS
+
+/* in Stackless, this is just a synonym */
+#define PyHeapTypeObject PyTypeObject
+
+#define PyHeapType_GET_MEMBERS(etype) \
+    ((PyMemberDef *)(((char *)etype) + (etype)->ob_type->tp_basicsize))
+#else
+
 /* The *real* layout of a type object when allocated on the heap */
 typedef struct _heaptypeobject {
 	/* Note: there's a dependency on the order of these members
@@ -366,6 +391,7 @@
 #define PyHeapType_GET_MEMBERS(etype) \
     ((PyMemberDef *)(((char *)etype) + (etype)->ht_type.ob_type->tp_basicsize))
 
+#endif
 
 /* Generic type check */
 PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *);
@@ -509,7 +535,8 @@
 
 /* These two bits are preserved for Stackless Python, next after this is 17 */
 #ifdef STACKLESS
-#define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION (3L<<15)
+#define Py_TPFLAGS_HAVE_STACKLESS_CALL (1L<<15)
+#define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION (1L<<16)
 #else
 #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0
 #endif

Modified: stackless/trunk/Include/pyerrors.h
==============================================================================
--- stackless/trunk/Include/pyerrors.h	(original)
+++ stackless/trunk/Include/pyerrors.h	Wed Jun 28 15:34:33 2006
@@ -114,12 +114,15 @@
 	  ? (PyObject*)((PyInstanceObject*)(x))->in_class		\
 	  : (PyObject*)((x)->ob_type)))
 
-	
+
 /* Predefined exceptions */
 
 PyAPI_DATA(PyObject *) PyExc_BaseException;
 PyAPI_DATA(PyObject *) PyExc_Exception;
 PyAPI_DATA(PyObject *) PyExc_StopIteration;
+#ifdef STACKLESS
+PyAPI_DATA(PyObject *) PyExc_TaskletExit;
+#endif
 PyAPI_DATA(PyObject *) PyExc_GeneratorExit;
 PyAPI_DATA(PyObject *) PyExc_StandardError;
 PyAPI_DATA(PyObject *) PyExc_ArithmeticError;
@@ -227,7 +230,7 @@
 /* Issue a warning or exception */
 PyAPI_FUNC(int) PyErr_Warn(PyObject *, char *);
 PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, const char *,
-				   const char *, int, 
+				   const char *, int,
 				   const char *, PyObject *);
 
 /* In sigcheck.c or signalmodule.c */

Modified: stackless/trunk/Include/pystate.h
==============================================================================
--- stackless/trunk/Include/pystate.h	(original)
+++ stackless/trunk/Include/pystate.h	Wed Jun 28 15:34:33 2006
@@ -4,6 +4,9 @@
 
 #ifndef Py_PYSTATE_H
 #define Py_PYSTATE_H
+#ifdef STACKLESS
+#include "core/stackless_tstate.h"
+#endif
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -94,6 +97,10 @@
     PyObject *async_exc; /* Asynchronous exception to raise */
     long thread_id; /* Thread id where this tstate was created */
 
+#ifdef STACKLESS
+	PyStacklessState st;
+#endif
+
     /* XXX signal handlers should also be here */
 
 } PyThreadState;

Modified: stackless/trunk/Lib/copy_reg.py
==============================================================================
--- stackless/trunk/Lib/copy_reg.py	(original)
+++ stackless/trunk/Lib/copy_reg.py	Wed Jun 28 15:34:33 2006
@@ -67,6 +67,13 @@
     else:
         if base is self.__class__:
             raise TypeError, "can't pickle %s objects" % base.__name__
+        ## Stackless addition BEGIN
+        # if base is only supported by our shadow types in copy_reg,
+        # we need to substitute here:
+        reducer = dispatch_table.get(base)
+        if reducer and reducer.__module__ == "stackless._wrap":
+            base = reducer(self)[0]
+        ## Stackless addition END
         state = base(self)
     args = (self.__class__, base, state)
     try:

Modified: stackless/trunk/Lib/pickle.py
==============================================================================
--- stackless/trunk/Lib/pickle.py	(original)
+++ stackless/trunk/Lib/pickle.py	Wed Jun 28 15:34:33 2006
@@ -205,6 +205,13 @@
         self.proto = int(protocol)
         self.bin = protocol >= 1
         self.fast = 0
+        ## Stackless addition BEGIN
+        try:
+            from stackless import _pickle_moduledict
+        except ImportError:
+            _pickle_moduledict = lambda self, obj:None
+        self._pickle_moduledict = _pickle_moduledict
+        ## Stackless addition END
 
     def clear_memo(self):
         """Clears the pickler's "memo".
@@ -638,6 +645,11 @@
             # else tmp is empty, and we're done
 
     def save_dict(self, obj):
+        ## Stackless addition BEGIN
+        modict_saver = self._pickle_moduledict(self, obj)
+        if modict_saver is not None:
+            return self.save_reduce(*modict_saver)
+        ## Stackless addition END
         write = self.write
 
         if self.bin:
@@ -767,8 +779,30 @@
         write(GLOBAL + module + '\n' + name + '\n')
         self.memoize(obj)
 
+    def save_function(self, obj):
+        try:
+            return self.save_global(obj)
+        except PicklingError, e:
+            pass
+        # Check copy_reg.dispatch_table
+        reduce = dispatch_table.get(type(obj))
+        if reduce:
+            rv = reduce(obj)
+        else:
+            # Check for a __reduce_ex__ method, fall back to __reduce__
+            reduce = getattr(obj, "__reduce_ex__", None)
+            if reduce:
+                rv = reduce(self.proto)
+            else:
+                reduce = getattr(obj, "__reduce__", None)
+                if reduce:
+                    rv = reduce()
+                else:
+                    raise e
+        return self.save_reduce(obj=obj, *rv)
+
     dispatch[ClassType] = save_global
-    dispatch[FunctionType] = save_global
+    dispatch[FunctionType] = save_function
     dispatch[BuiltinFunctionType] = save_global
     dispatch[TypeType] = save_global
 
@@ -796,6 +830,7 @@
 
 classmap = {} # called classmap for backwards compatibility
 
+# This is no longer used to find classes, but still for functions
 def whichmodule(func, funcname):
     """Figure out the module in which a function occurs.
 

Modified: stackless/trunk/Makefile.pre.in
==============================================================================
--- stackless/trunk/Makefile.pre.in	(original)
+++ stackless/trunk/Makefile.pre.in	Wed Jun 28 15:34:33 2006
@@ -61,7 +61,7 @@
 # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
 # be able to build extension modules using the directories specified in the
 # environment variables
-CPPFLAGS=	-I. -I$(srcdir)/Include @CPPFLAGS@
+CPPFLAGS=	-I. -I$(srcdir)/Include -I$(srcdir)/Stackless @CPPFLAGS@
 LDFLAGS=	@LDFLAGS@
 LDLAST=		@LDLAST@
 SGI_ABI=	@SGI_ABI@
@@ -71,7 +71,8 @@
 CFLAGSFORSHARED=@CFLAGSFORSHARED@
 # C flags used for building the interpreter object files
 PY_CFLAGS=	$(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
-
+# Special C flags for slp_transfer.c
+SLPFLAGS=	@SLPFLAGS@
 
 # Machine-dependent subdirectories
 MACHDEP=	@MACHDEP@
@@ -96,6 +97,12 @@
 INCLUDEPY=	$(INCLUDEDIR)/python$(VERSION)
 CONFINCLUDEPY=	$(CONFINCLUDEDIR)/python$(VERSION)
 LIBP=		$(LIBDIR)/python$(VERSION)
+STACKLESSINCLUDEDIRS=		\
+		core \
+		module \
+		pickling \
+		platf
+
 
 # Symbols used for using shared libraries
 SO=		@SO@
@@ -241,6 +248,16 @@
 		Python/ast.o \
 		Python/bltinmodule.o \
 		Python/ceval.o \
+		Stackless/core/cframeobject.o \
+		Stackless/core/slp_transfer.o \
+		Stackless/core/stacklesseval.o \
+		Stackless/core/stackless_util.o \
+		Stackless/module/channelobject.o \
+		Stackless/module/flextype.o \
+		Stackless/module/scheduling.o \
+		Stackless/module/stacklessmodule.o \
+		Stackless/module/taskletobject.o \
+		Stackless/pickling/prickelpit.o \
 		Python/compile.o \
 		Python/codecs.o \
 		Python/errors.o \
@@ -497,6 +514,9 @@
 Objects/unicodectype.o:	$(srcdir)/Objects/unicodectype.c \
 				$(srcdir)/Objects/unicodetype_db.h
 
+Stackless/core/slp_transfer.o: $(srcdir)/Stackless/core/slp_transfer.c
+		$(CC) -c $(PY_CFLAGS) $(SLPFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Stackless/core/slp_transfer.c
+
 ############################################################################
 # Header files
 
@@ -553,6 +573,24 @@
 		Include/tupleobject.h \
 		Include/unicodeobject.h \
 		Include/weakrefobject.h \
+		Stackless/stackless.h \
+		Stackless/stackless_api.h \
+		Stackless/stackless_version.h \
+		Stackless/core/cframeobject.h \
+		Stackless/core/stackless_impl.h \
+		Stackless/core/stackless_structs.h \
+		Stackless/core/stackless_tstate.h \
+		Stackless/module/channelobject.h \
+		Stackless/module/flextype.h \
+		Stackless/module/taskletobject.h \
+		Stackless/pickling/prickelpit.h \
+		Stackless/platf/slp_platformselect.h \
+		Stackless/platf/switch_ppc_macosx.h \
+		Stackless/platf/switch_ppc_unix.h \
+		Stackless/platf/switch_s390_unix.h \
+		Stackless/platf/switch_sparc_sun_gcc.h \
+		Stackless/platf/switch_x86_msvc.h \
+		Stackless/platf/switch_x86_unix.h \
 		pyconfig.h
 
 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
@@ -807,11 +845,24 @@
 		else	true; \
 		fi; \
 	done
-	@for i in $(srcdir)/Include/*.h; \
+	@for i in $(srcdir)/Include/*.h $(srcdir)/Stackless/*.h; \
 	do \
 		echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
 		$(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
 	done
+	@for j in $(STACKLESSINCLUDEDIRS); \
+	do \
+		if test ! -d $(DESTDIR)$(INCLUDEPY)$$j; then \
+			echo "Creating directory $(DESTDIR)$(INCLUDEPY)/$$j"; \
+			$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(INCLUDEPY)/$$j; \
+		else	true; \
+		fi; \
+		for i in $(srcdir)/Stackless/$$j/*.h; \
+		do \
+			echo $(INSTALL_DATA) $$i $(INCLUDEPY)/$$j; \
+			$(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY)/$$j; \
+		done \
+	done
 	$(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
 
 # Install the library and miscellaneous stuff needed for extending/embedding

Modified: stackless/trunk/Modules/Setup.dist
==============================================================================
--- stackless/trunk/Modules/Setup.dist	(original)
+++ stackless/trunk/Modules/Setup.dist	Wed Jun 28 15:34:33 2006
@@ -482,3 +482,8 @@
 
 # Another example -- the 'xxsubtype' module shows C-level subtyping in action
 xxsubtype xxsubtype.c
+
+# uncomment if you'd like to compile stackless statically.
+# Note that the static build puts the .o files into Modules.
+#SLP=./Stackless
+#stackless $(SLP)/stacklessmodule.c $(SLP)/atomicobject.c $(SLP)/cframeobject.c $(SLP)/channelobject.c $(SLP)/flextype.c $(SLP)/scheduling.c $(SLP)/schedulerobject.c $(SLP)/stackless_debug.c $(SLP)/stackless_util.c $(SLP)/taskletobject.c

Modified: stackless/trunk/Modules/cPickle.c
==============================================================================
--- stackless/trunk/Modules/cPickle.c	(original)
+++ stackless/trunk/Modules/cPickle.c	Wed Jun 28 15:34:33 2006
@@ -1,6 +1,8 @@
 #include "Python.h"
 #include "cStringIO.h"
 #include "structmember.h"
+#include "core/stackless_impl.h"
+#include "platf/slp_platformselect.h"
 
 PyDoc_STRVAR(cPickle_module_documentation,
 "C implementation and optimization of the Python pickle module.");
@@ -123,7 +125,7 @@
   *__getstate___str, *__setstate___str, *__name___str, *__reduce___str,
   *__reduce_ex___str,
   *write_str, *append_str,
-  *read_str, *readline_str, *__main___str, 
+  *read_str, *readline_str, *__main___str,
   *copy_reg_str, *dispatch_table_str;
 
 /*************************************************************************
@@ -345,6 +347,9 @@
 	PyObject *dispatch_table;
 	int fast_container; /* count nested container dumps */
 	PyObject *fast_memo;
+#ifdef STACKLESS
+	PyObject *module_dict_ids;
+#endif
 } Picklerobject;
 
 #ifndef PY_CPICKLE_FAST_LIMIT
@@ -843,7 +848,7 @@
 		*global_name_attr = 0, *name = 0;
 
 	module = PyObject_GetAttrString(global, "__module__");
-	if (module) 
+	if (module)
 		return module;
 	if (PyErr_ExceptionMatches(PyExc_AttributeError))
 		PyErr_Clear();
@@ -2294,11 +2299,21 @@
 	int res = -1;
 	int tmp, size;
 
+#ifdef STACKLESS
+	/* for debugging */
+	++self->nesting;
+	/* but we save the stack after a fixed watermark */
+	if (CSTACK_SAVE_NOW(PyThreadState_GET(), self)) {
+		res = slp_safe_pickling((void *)&save, (PyObject *)self, args, pers_save);
+		goto finally;
+	}
+#else
         if (self->nesting++ > Py_GetRecursionLimit()){
 		PyErr_SetString(PyExc_RuntimeError,
 				"maximum recursion depth exceeded");
 		goto finally;
 	}
+#endif
 
 	if (!pers_save && self->pers_func) {
 		if ((tmp = save_pers(self, args, self->pers_func)) != 0) {
@@ -2414,6 +2429,18 @@
 
         case 'd':
 		if (type == &PyDict_Type) {
+#ifdef STACKLESS
+			PyObject *ret = PyStackless_Pickle_ModuleDict(
+					    (PyObject *) self, args);
+
+			if (ret == NULL) return -1;
+			if (ret != Py_None) {
+				res = save_reduce(self, ret, args);
+				Py_DECREF(ret);
+				goto finally;
+			}
+			Py_DECREF(ret);
+#endif
 			res = save_dict(self, args);
 			goto finally;
 		}
@@ -2792,6 +2819,9 @@
 	self->fast_memo = NULL;
 	self->buf_size = 0;
 	self->dispatch_table = NULL;
+#ifdef STACKLESS
+	self->module_dict_ids = NULL;
+#endif
 
 	self->file = NULL;
 	if (file)
@@ -2905,6 +2935,9 @@
 	Py_XDECREF(self->inst_pers_func);
 	Py_XDECREF(self->dispatch_table);
 	PyMem_Free(self->write_buf);
+#ifdef STACKLESS
+	Py_XDECREF(self->module_dict_ids);
+#endif
 	self->ob_type->tp_free((PyObject *)self);
 }
 
@@ -2919,6 +2952,9 @@
 	Py_VISIT(self->pers_func);
 	Py_VISIT(self->inst_pers_func);
 	Py_VISIT(self->dispatch_table);
+#ifdef STACKLESS
+	Py_VISIT(self->module_dict_ids);
+#endif
 	return 0;
 }
 
@@ -2933,6 +2969,9 @@
 	Py_CLEAR(self->pers_func);
 	Py_CLEAR(self->inst_pers_func);
 	Py_CLEAR(self->dispatch_table);
+#ifdef STACKLESS
+	Py_CLEAR(self->module_dict_ids);
+#endif
 	return 0;
 }
 
@@ -3002,6 +3041,36 @@
 	return 0;
 }
 
+#ifdef STACKLESS
+static PyObject *
+Pickler_get_module_dict_ids(Picklerobject *p)
+{
+	if (p->module_dict_ids == NULL)
+		PyErr_SetString(PyExc_AttributeError, "module_dict_ids");
+	else
+		Py_INCREF(p->module_dict_ids);
+	return p->module_dict_ids;
+}
+
+static int
+Pickler_set_module_dict_ids(Picklerobject *p, PyObject *v)
+{
+	if (v == NULL) {
+		PyErr_SetString(PyExc_TypeError,
+				"attribute deletion is not supported");
+		return -1;
+	}
+	if (!PyDict_Check(v)) {
+		PyErr_SetString(PyExc_TypeError, "module-dict-ids must be a dictionary");
+		return -1;
+	}
+	Py_XDECREF(p->module_dict_ids);
+	Py_INCREF(v);
+	p->module_dict_ids = v;
+	return 0;
+}
+#endif
+
 static PyObject *
 Pickler_get_error(Picklerobject *p)
 {
@@ -3022,6 +3091,9 @@
     {"inst_persistent_id", NULL, (setter)Pickler_set_inst_pers_func},
     {"memo", (getter)Pickler_get_memo, (setter)Pickler_set_memo},
     {"PicklingError", (getter)Pickler_get_error, NULL},
+#ifdef STACKLESS
+    {"module_dict_ids", (getter)Pickler_get_module_dict_ids, (setter)Pickler_set_module_dict_ids},
+#endif
     {NULL}
 };
 

Modified: stackless/trunk/Objects/abstract.c
==============================================================================
--- stackless/trunk/Objects/abstract.c	(original)
+++ stackless/trunk/Objects/abstract.c	Wed Jun 28 15:34:33 2006
@@ -4,6 +4,7 @@
 #include <ctype.h>
 #include "structmember.h" /* we need the offsetof() macro from there */
 #include "longintrepr.h"
+#include "core/stackless_impl.h"
 
 #define NEW_STYLE_NUMBER(o) PyType_HasFeature((o)->ob_type, \
 				Py_TPFLAGS_CHECKTYPES)
@@ -939,7 +940,7 @@
 }
 
 /* Return a Py_ssize_t integer from the object item */
-Py_ssize_t 
+Py_ssize_t
 PyNumber_Index(PyObject *item)
 {
 	Py_ssize_t value = -1;
@@ -1467,7 +1468,7 @@
 		if (j >= n) {
 			Py_ssize_t oldn = n;
 			/* The over-allocation strategy can grow a bit faster
-			   than for lists because unlike lists the 
+			   than for lists because unlike lists the
 			   over-allocation isn't permanent -- we reclaim
 			   the excess before the end of this routine.
 			   So, grow by ten and then add 25%.
@@ -1478,7 +1479,7 @@
 				/* Check for overflow */
 				PyErr_NoMemory();
 				Py_DECREF(item);
-				goto Fail; 
+				goto Fail;
 			}
 			if (_PyTuple_Resize(&result, n) != 0) {
 				Py_DECREF(item);
@@ -1687,7 +1688,7 @@
 
 	return  o && o->ob_type->tp_as_mapping &&
 		o->ob_type->tp_as_mapping->mp_subscript &&
-		!(o->ob_type->tp_as_sequence && 
+		!(o->ob_type->tp_as_sequence &&
 		  o->ob_type->tp_as_sequence->sq_slice);
 }
 
@@ -1793,10 +1794,20 @@
 PyObject *
 PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw)
 {
+	STACKLESS_GETARG();
         ternaryfunc call;
 
 	if ((call = func->ob_type->tp_call) != NULL) {
 		PyObject *result = NULL;
+#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
+		   and then destroy it when it ends.  At which point
+		   schedule_task_destruct finds the recursion addition
+		   and disagrees with its presence asserting.
+		   */
+#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
@@ -1805,8 +1816,12 @@
 		if (Py_EnterRecursiveCall(" in __call__")) {
 		    return NULL;
 		}
-		result = (*call)(func, arg, kw);
+#endif
+		result = (STACKLESS_PROMOTE(func), (*call)(func, arg, kw));
+		STACKLESS_ASSERT();
+#ifndef STACKLESS
 		Py_LeaveRecursiveCall();
+#endif
 		if (result == NULL && !PyErr_Occurred())
 			PyErr_SetString(
 				PyExc_SystemError,
@@ -1821,6 +1836,7 @@
 static PyObject*
 call_function_tail(PyObject *callable, PyObject *args)
 {
+	STACKLESS_GETARG();
 	PyObject *retval;
 
 	if (args == NULL)
@@ -1837,7 +1853,9 @@
 		PyTuple_SET_ITEM(a, 0, args);
 		args = a;
 	}
+	STACKLESS_PROMOTE_ALL();
 	retval = PyObject_Call(callable, args, NULL);
+	STACKLESS_ASSERT();
 
 	Py_DECREF(args);
 
@@ -1847,6 +1865,8 @@
 PyObject *
 PyObject_CallFunction(PyObject *callable, char *format, ...)
 {
+	/* Maybe need to pass this through.. need to check that.
+	  STACKLESS_GETARG(); */
 	va_list va;
 	PyObject *args;
 
@@ -1867,6 +1887,8 @@
 PyObject *
 _PyObject_CallFunction_SizeT(PyObject *callable, char *format, ...)
 {
+	/* Maybe need to pass this through.. need to check that.
+	  STACKLESS_GETARG(); */
 	va_list va;
 	PyObject *args;
 
@@ -1902,7 +1924,7 @@
 	}
 
 	if (!PyCallable_Check(func)) {
-		type_error("attribute of type '%.200s' is not callable", func); 
+		type_error("attribute of type '%.200s' is not callable", func);
 		goto exit;
 	}
 
@@ -1941,7 +1963,7 @@
 	}
 
 	if (!PyCallable_Check(func)) {
-		type_error("attribute of type '%.200s' is not callable", func); 
+		type_error("attribute of type '%.200s' is not callable", func);
 		goto exit;
 	}
 
@@ -1996,6 +2018,7 @@
 PyObject *
 PyObject_CallMethodObjArgs(PyObject *callable, PyObject *name, ...)
 {
+	STACKLESS_GETARG();
 	PyObject *args, *tmp;
 	va_list vargs;
 
@@ -2014,7 +2037,9 @@
 		Py_DECREF(callable);
 		return NULL;
 	}
+	STACKLESS_PROMOTE_ALL();
 	tmp = PyObject_Call(callable, args, NULL);
+	STACKLESS_ASSERT();
 	Py_DECREF(args);
 	Py_DECREF(callable);
 
@@ -2024,6 +2049,7 @@
 PyObject *
 PyObject_CallFunctionObjArgs(PyObject *callable, ...)
 {
+	STACKLESS_GETARG();
 	PyObject *args, *tmp;
 	va_list vargs;
 
@@ -2036,7 +2062,9 @@
 	va_end(vargs);
 	if (args == NULL)
 		return NULL;
+	STACKLESS_PROMOTE_ALL();
 	tmp = PyObject_Call(callable, args, NULL);
+	STACKLESS_ASSERT();
 	Py_DECREF(args);
 
 	return tmp;
@@ -2319,9 +2347,15 @@
 PyObject *
 PyIter_Next(PyObject *iter)
 {
+	STACKLESS_GETARG();
 	PyObject *result;
 	assert(PyIter_Check(iter));
+#ifdef STACKLESS
+	/* we use the same flag here, since iterators are not callable */
+#endif
+	STACKLESS_PROMOTE_METHOD(iter, tp_iternext);
 	result = (*iter->ob_type->tp_iternext)(iter);
+	STACKLESS_ASSERT();
 	if (result == NULL &&
 	    PyErr_Occurred() &&
 	    PyErr_ExceptionMatches(PyExc_StopIteration))

Modified: stackless/trunk/Objects/classobject.c
==============================================================================
--- stackless/trunk/Objects/classobject.c	(original)
+++ stackless/trunk/Objects/classobject.c	Wed Jun 28 15:34:33 2006
@@ -3,6 +3,7 @@
 
 #include "Python.h"
 #include "structmember.h"
+#include "core/stackless_impl.h"
 
 #define TP_DESCR_GET(t) \
     (PyType_HasFeature(t, Py_TPFLAGS_HAVE_CLASS) ? (t)->tp_descr_get : NULL)
@@ -1958,6 +1959,7 @@
 static PyObject *
 instance_call(PyObject *func, PyObject *arg, PyObject *kw)
 {
+	STACKLESS_GETARG();
 	PyObject *res, *call = PyObject_GetAttrString(func, "__call__");
 	if (call == NULL) {
 		PyInstanceObject *inst = (PyInstanceObject*) func;
@@ -1981,7 +1983,9 @@
 		res = NULL;
 	}
 	else {
+		STACKLESS_PROMOTE_ALL();
 		res = PyObject_Call(call, arg, kw);
+		STACKLESS_ASSERT();
 		Py_LeaveRecursiveCall();
 	}
 	Py_DECREF(call);
@@ -2073,6 +2077,7 @@
 	instance_new,				/* tp_new */
 };
 
+STACKLESS_DECLARE_METHOD(&PyInstance_Type, tp_call)
 
 /* Instance method objects are used for two purposes:
    (a) as bound instance methods (returned by instancename.methodname)
@@ -2372,6 +2377,7 @@
 static PyObject *
 instancemethod_call(PyObject *func, PyObject *arg, PyObject *kw)
 {
+	STACKLESS_GETARG();
 	PyObject *self = PyMethod_GET_SELF(func);
 	PyObject *klass = PyMethod_GET_CLASS(func);
 	PyObject *result;
@@ -2423,7 +2429,9 @@
 		}
 		arg = newarg;
 	}
+	STACKLESS_PROMOTE_ALL();
 	result = PyObject_Call((PyObject *)func, arg, kw);
+	STACKLESS_ASSERT();
 	Py_DECREF(arg);
 	return result;
 }
@@ -2496,6 +2504,8 @@
 	instancemethod_new,			/* tp_new */
 };
 
+STACKLESS_DECLARE_METHOD(&PyMethod_Type, tp_call)
+
 /* Clear out the free list */
 
 void

Modified: stackless/trunk/Objects/descrobject.c
==============================================================================
--- stackless/trunk/Objects/descrobject.c	(original)
+++ stackless/trunk/Objects/descrobject.c	Wed Jun 28 15:34:33 2006
@@ -2,6 +2,7 @@
 
 #include "Python.h"
 #include "structmember.h" /* Why is this not included in Python.h? */
+#include "core/stackless_impl.h"
 
 static void
 descr_dealloc(PyDescrObject *descr)
@@ -31,28 +32,28 @@
 static PyObject *
 method_repr(PyMethodDescrObject *descr)
 {
-	return descr_repr((PyDescrObject *)descr, 
+	return descr_repr((PyDescrObject *)descr,
 			  "<method '%s' of '%s' objects>");
 }
 
 static PyObject *
 member_repr(PyMemberDescrObject *descr)
 {
-	return descr_repr((PyDescrObject *)descr, 
+	return descr_repr((PyDescrObject *)descr,
 			  "<member '%s' of '%s' objects>");
 }
 
 static PyObject *
 getset_repr(PyGetSetDescrObject *descr)
 {
-	return descr_repr((PyDescrObject *)descr, 
+	return descr_repr((PyDescrObject *)descr,
 			  "<attribute '%s' of '%s' objects>");
 }
 
 static PyObject *
 wrapperdescr_repr(PyWrapperDescrObject *descr)
 {
-	return descr_repr((PyDescrObject *)descr, 
+	return descr_repr((PyDescrObject *)descr,
 			  "<slot wrapper '%s' of '%s' objects>");
 }
 
@@ -209,6 +210,7 @@
 static PyObject *
 methoddescr_call(PyMethodDescrObject *descr, PyObject *args, PyObject *kwds)
 {
+	STACKLESS_GETARG();
 	Py_ssize_t argc;
 	PyObject *self, *func, *result;
 
@@ -243,7 +245,9 @@
 		Py_DECREF(func);
 		return NULL;
 	}
+	STACKLESS_PROMOTE_ALL();
 	result = PyEval_CallObjectWithKeywords(func, args, kwds);
+	STACKLESS_ASSERT();
 	Py_DECREF(args);
 	Py_DECREF(func);
 	return result;
@@ -253,13 +257,16 @@
 classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args,
 		      PyObject *kwds)
 {
+	STACKLESS_GETARG();
 	PyObject *func, *result;
 
 	func = PyCFunction_New(descr->d_method, (PyObject *)descr->d_type);
 	if (func == NULL)
 		return NULL;
 
+	STACKLESS_PROMOTE_ALL();
 	result = PyEval_CallObjectWithKeywords(func, args, kwds);
+	STACKLESS_ASSERT();
 	Py_DECREF(func);
 	return result;
 }
@@ -267,6 +274,7 @@
 static PyObject *
 wrapperdescr_call(PyWrapperDescrObject *descr, PyObject *args, PyObject *kwds)
 {
+	STACKLESS_GETARG();
 	Py_ssize_t argc;
 	PyObject *self, *func, *result;
 
@@ -301,7 +309,9 @@
 		Py_DECREF(func);
 		return NULL;
 	}
+	STACKLESS_PROMOTE_ALL();
 	result = PyEval_CallObjectWithKeywords(func, args, kwds);
+	STACKLESS_ASSERT();
 	Py_DECREF(args);
 	Py_DECREF(func);
 	return result;
@@ -381,7 +391,11 @@
 	return 0;
 }
 
+#ifdef STACKLESS
+PyTypeObject PyMethodDescr_Type = {
+#else
 static PyTypeObject PyMethodDescr_Type = {
+#endif
 	PyObject_HEAD_INIT(&PyType_Type)
 	0,
 	"method_descriptor",
@@ -419,8 +433,14 @@
 	0,					/* tp_descr_set */
 };
 
+STACKLESS_DECLARE_METHOD(&PyMethodDescr_Type, tp_call)
+
 /* This is for METH_CLASS in C, not for "f = classmethod(f)" in Python! */
+#ifdef STACKLESS
+PyTypeObject PyClassMethodDescr_Type = {
+#else
 static PyTypeObject PyClassMethodDescr_Type = {
+#endif
 	PyObject_HEAD_INIT(&PyType_Type)
 	0,
 	"classmethod_descriptor",
@@ -458,6 +478,8 @@
 	0,					/* tp_descr_set */
 };
 
+STACKLESS_DECLARE_METHOD(&PyClassMethodDescr_Type, tp_call)
+
 static PyTypeObject PyMemberDescr_Type = {
 	PyObject_HEAD_INIT(&PyType_Type)
 	0,
@@ -572,6 +594,8 @@
 	0,					/* tp_descr_set */
 };
 
+/* STACKLESS_DECLARE_METHOD(&PyWrapperDescr_Type, tp_call) */
+
 static PyDescrObject *
 descr_new(PyTypeObject *descrtype, PyTypeObject *type, const char *name)
 {
@@ -648,6 +672,9 @@
 	if (descr != NULL) {
 		descr->d_base = base;
 		descr->d_wrapped = wrapped;
+#ifdef STACKLESS
+		descr->d_slpmask = 0;
+#endif
 	}
 	return (PyObject *)descr;
 }
@@ -978,12 +1005,17 @@
 static PyObject *
 wrapper_call(wrapperobject *wp, PyObject *args, PyObject *kwds)
 {
+	STACKLESS_GETARG();
 	wrapperfunc wrapper = wp->descr->d_base->wrapper;
 	PyObject *self = wp->self;
+	PyObject *ret;
 
 	if (wp->descr->d_base->flags & PyWrapperFlag_KEYWORDS) {
 		wrapperfunc_kwds wk = (wrapperfunc_kwds)wrapper;
-		return (*wk)(self, args, wp->descr->d_wrapped, kwds);
+		STACKLESS_PROMOTE_WRAPPER(wp);
+		ret = (*wk)(self, args, wp->descr->d_wrapped, kwds);
+		STACKLESS_ASSERT();
+		return ret;
 	}
 
 	if (kwds != NULL && (!PyDict_Check(kwds) || PyDict_Size(kwds) != 0)) {
@@ -992,7 +1024,10 @@
 			     wp->descr->d_base->name);
 		return NULL;
 	}
-	return (*wrapper)(self, args, wp->descr->d_wrapped);
+	STACKLESS_PROMOTE_WRAPPER(wp);
+	ret = (*wrapper)(self, args, wp->descr->d_wrapped);
+	STACKLESS_ASSERT();
+	return ret;
 }
 
 static int
@@ -1004,7 +1039,12 @@
 	return 0;
 }
 
+#ifdef STACKLESS
+#define wrappertype PyMethodWrapper_Type
+PyTypeObject PyMethodWrapper_Type = {
+#else
 static PyTypeObject wrappertype = {
+#endif
 	PyObject_HEAD_INIT(&PyType_Type)
 	0,					/* ob_size */
 	"method-wrapper",			/* tp_name */
@@ -1043,6 +1083,8 @@
 	0,					/* tp_descr_set */
 };
 
+STACKLESS_DECLARE_METHOD(&PyMethodWrapper_Type, tp_call)
+
 PyObject *
 PyWrapper_New(PyObject *d, PyObject *self)
 {
@@ -1190,7 +1232,7 @@
 		del = NULL;
 
 	/* if no docstring given and the getter has one, use that one */
-	if ((doc == NULL || doc == Py_None) && get != NULL && 
+	if ((doc == NULL || doc == Py_None) && get != NULL &&
 	    PyObject_HasAttrString(get, "__doc__")) {
 		if (!(get_doc = PyObject_GetAttrString(get, "__doc__")))
 			return -1;

Modified: stackless/trunk/Objects/exceptions.c
==============================================================================
--- stackless/trunk/Objects/exceptions.c	(original)
+++ stackless/trunk/Objects/exceptions.c	Wed Jun 28 15:34:33 2006
@@ -422,6 +422,13 @@
 SimpleExtendsException(PyExc_Exception, GeneratorExit,
                        "Request that a generator exit.");
 
+#ifdef STACKLESS
+/*
+ *    TaskletExit extends Exception
+ */
+SimpleExtendsException(PyExc_Exception, TaskletExit,
+                       "This exception is used to silently kill a tasklet");
+#endif
 
 /*
  *    SystemExit extends BaseException
@@ -2001,6 +2008,9 @@
     PRE_INIT(TypeError)
     PRE_INIT(StopIteration)
     PRE_INIT(GeneratorExit)
+#ifdef STACKLESS
+    PRE_INIT(TaskletExit);
+#endif
     PRE_INIT(SystemExit)
     PRE_INIT(KeyboardInterrupt)
     PRE_INIT(ImportError)
@@ -2066,6 +2076,7 @@
     POST_INIT(TypeError)
     POST_INIT(StopIteration)
     POST_INIT(GeneratorExit)
+    POST_INIT(TaskletExit)
     POST_INIT(SystemExit)
     POST_INIT(KeyboardInterrupt)
     POST_INIT(ImportError)

Modified: stackless/trunk/Objects/frameobject.c
==============================================================================
--- stackless/trunk/Objects/frameobject.c	(original)
+++ stackless/trunk/Objects/frameobject.c	Wed Jun 28 15:34:33 2006
@@ -15,7 +15,9 @@
 #define OFF(x) offsetof(PyFrameObject, x)
 
 static PyMemberDef frame_memberlist[] = {
+#ifndef STACKLESS
 	{"f_back",	T_OBJECT,	OFF(f_back),	RO},
+#endif
 	{"f_code",	T_OBJECT,	OFF(f_code),	RO},
 	{"f_builtins",	T_OBJECT,	OFF(f_builtins),RO},
 	{"f_globals",	T_OBJECT,	OFF(f_globals),	RO},
@@ -346,7 +348,29 @@
 	return PyBool_FromLong(PyFrame_IsRestricted(f));
 }
 
+#ifdef STACKLESS
+
+static PyObject *
+frame_getback(PyFrameObject *f, void *nope)
+{
+	PyFrameObject *fb = f->f_back;
+	PyObject *ret;
+	while (fb != NULL && ! PyFrame_Check(fb))
+		fb = fb->f_back;
+	ret = (PyObject *) fb;
+	if (ret == NULL)
+		ret = Py_None;
+    Py_INCREF(ret);
+    return ret;
+}
+
+#endif
+
+
 static PyGetSetDef frame_getsetlist[] = {
+#ifdef STACKLESS
+	{"f_back",	(getter)frame_getback, NULL, NULL},
+#endif
 	{"f_locals",	(getter)frame_getlocals, NULL, NULL},
 	{"f_lineno",	(getter)frame_getlineno,
 			(setter)frame_setlineno, NULL},
@@ -369,7 +393,7 @@
    the following fields are still valid:
 
      * ob_type, ob_size, f_code, f_valuestack;
-       
+
      * f_locals, f_trace,
        f_exc_type, f_exc_value, f_exc_traceback are NULL;
 
@@ -438,7 +462,7 @@
 		f->f_back = free_list;
 		free_list = f;
         }
-	else 
+	else
 		PyObject_GC_Del(f);
 
         Py_DECREF(co);
@@ -673,6 +697,9 @@
 	f->f_iblock = 0;
 
         f->f_stacktop = f->f_valuestack;
+#ifdef STACKLESS
+	f->f_execute = NULL;
+#endif
 	_PyObject_GC_TRACK(f);
 	return f;
 }
@@ -826,7 +853,7 @@
 		dict_to_map(co->co_cellvars, ncells,
 			    locals, fast + co->co_nlocals, 1, clear);
 		dict_to_map(co->co_freevars, nfreevars,
-			    locals, fast + co->co_nlocals + ncells, 1, 
+			    locals, fast + co->co_nlocals + ncells, 1,
  			    clear);
 	}
 	PyErr_Restore(error_type, error_value, error_traceback);

Modified: stackless/trunk/Objects/funcobject.c
==============================================================================
--- stackless/trunk/Objects/funcobject.c	(original)
+++ stackless/trunk/Objects/funcobject.c	Wed Jun 28 15:34:33 2006
@@ -5,6 +5,7 @@
 #include "code.h"
 #include "eval.h"
 #include "structmember.h"
+#include "core/stackless_impl.h"
 
 PyObject *
 PyFunction_New(PyObject *code, PyObject *globals)
@@ -480,6 +481,7 @@
 static PyObject *
 function_call(PyObject *func, PyObject *arg, PyObject *kw)
 {
+	STACKLESS_GETARG();
 	PyObject *result;
 	PyObject *argdefs;
 	PyObject **d, **k;
@@ -514,12 +516,14 @@
 		nk = 0;
 	}
 
+	STACKLESS_PROMOTE_ALL();
 	result = PyEval_EvalCodeEx(
 		(PyCodeObject *)PyFunction_GET_CODE(func),
 		PyFunction_GET_GLOBALS(func), (PyObject *)NULL,
 		&PyTuple_GET_ITEM(arg, 0), PyTuple_Size(arg),
 		k, nk, d, nd,
 		PyFunction_GET_CLOSURE(func));
+	STACKLESS_ASSERT();
 
 	if (k != NULL)
 		PyMem_DEL(k);
@@ -578,6 +582,7 @@
 	func_new,				/* tp_new */
 };
 
+STACKLESS_DECLARE_METHOD(&PyFunction_Type, tp_call)
 
 /* Class method object */
 

Modified: stackless/trunk/Objects/genobject.c
==============================================================================
--- stackless/trunk/Objects/genobject.c	(original)
+++ stackless/trunk/Objects/genobject.c	Wed Jun 28 15:34:33 2006
@@ -1,5 +1,7 @@
 /* Generator object implementation */
 
+#include "core/stackless_impl.h"
+
 #include "Python.h"
 #include "frameobject.h"
 #include "genobject.h"
@@ -38,7 +40,10 @@
 	PyObject_GC_Del(gen);
 }
 
-
+#ifdef STACKLESS
+PyObject *slp_gen_send_ex(PyGenObject *gen, PyObject *arg, int exc);
+#define gen_send_ex slp_gen_send_ex
+#else
 static PyObject *
 gen_send_ex(PyGenObject *gen, PyObject *arg, int exc)
 {
@@ -106,6 +111,7 @@
 
 	return result;
 }
+#endif
 
 PyDoc_STRVAR(send_doc,
 "send(arg) -> send 'arg' into generator,\n\
@@ -274,14 +280,12 @@
 	return NULL;
 }
 
-
 static PyObject *
 gen_iternext(PyGenObject *gen)
 {
 	return gen_send_ex(gen, NULL, 0);
 }
 
-
 static PyMemberDef gen_memberlist[] = {
 	{"gi_frame",	T_OBJECT, offsetof(PyGenObject, gi_frame),	RO},
 	{"gi_running",	T_INT,    offsetof(PyGenObject, gi_running),	RO},
@@ -347,8 +351,15 @@
 	gen_del,				/* tp_del */
 };
 
+STACKLESS_DECLARE_METHOD(&PyGen_Type, tp_iternext);
+
+#ifdef STACKLESS
+PyObject *
+PyGenerator_New(PyFrameObject *f)
+#else
 PyObject *
 PyGen_New(PyFrameObject *f)
+#endif
 {
 	PyGenObject *gen = PyObject_GC_New(PyGenObject, &PyGen_Type);
 	if (gen == NULL) {

Modified: stackless/trunk/Objects/methodobject.c
==============================================================================
--- stackless/trunk/Objects/methodobject.c	(original)
+++ stackless/trunk/Objects/methodobject.c	Wed Jun 28 15:34:33 2006
@@ -3,6 +3,7 @@
 
 #include "Python.h"
 #include "structmember.h"
+#include "core/stackless_impl.h"
 
 static PyCFunctionObject *free_list = NULL;
 
@@ -59,27 +60,44 @@
 	return ((PyCFunctionObject *)op) -> m_ml -> ml_flags;
 }
 
+#ifdef STACKLESS
+#define WRAP_RETURN(call) { \
+	PyObject * retval; \
+	STACKLESS_PROMOTE_FLAG(PyCFunction_GET_FLAGS(func) & METH_STACKLESS); \
+	retval = (call); \
+	STACKLESS_ASSERT(); \
+	return retval; \
+}
+#else
+#define WRAP_RETURN(call) return (call);
+#endif
+
 PyObject *
 PyCFunction_Call(PyObject *func, PyObject *arg, PyObject *kw)
 {
+	STACKLESS_GETARG();
 	PyCFunctionObject* f = (PyCFunctionObject*)func;
 	PyCFunction meth = PyCFunction_GET_FUNCTION(func);
 	PyObject *self = PyCFunction_GET_SELF(func);
 	Py_ssize_t size;
 
+#ifdef STACKLESS
+	switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS)) {
+#else
 	switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
+#endif
 	case METH_VARARGS:
 		if (kw == NULL || PyDict_Size(kw) == 0)
-			return (*meth)(self, arg);
+			WRAP_RETURN( (*meth)(self, arg) )
 		break;
 	case METH_VARARGS | METH_KEYWORDS:
 	case METH_OLDARGS | METH_KEYWORDS:
-		return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
+		WRAP_RETURN( (*(PyCFunctionWithKeywords)meth)(self, arg, kw) )
 	case METH_NOARGS:
 		if (kw == NULL || PyDict_Size(kw) == 0) {
 			size = PyTuple_GET_SIZE(arg);
 			if (size == 0)
-				return (*meth)(self, NULL);
+				WRAP_RETURN( (*meth)(self, NULL) )
 			PyErr_Format(PyExc_TypeError,
 			    "%.200s() takes no arguments (%zd given)",
 			    f->m_ml->ml_name, size);
@@ -90,7 +108,7 @@
 		if (kw == NULL || PyDict_Size(kw) == 0) {
 			size = PyTuple_GET_SIZE(arg);
 			if (size == 1)
-				return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
+				WRAP_RETURN( (*meth)(self, PyTuple_GET_ITEM(arg, 0)) )
 			PyErr_Format(PyExc_TypeError,
 			    "%.200s() takes exactly one argument (%zd given)",
 			    f->m_ml->ml_name, size);
@@ -105,7 +123,7 @@
 				arg = PyTuple_GET_ITEM(arg, 0);
 			else if (size == 0)
 				arg = NULL;
-			return (*meth)(self, arg);
+			WRAP_RETURN( (*meth)(self, arg) )
 		}
 		break;
 	default:
@@ -266,6 +284,8 @@
 	0,					/* tp_dict */
 };
 
+STACKLESS_DECLARE_METHOD(&PyCFunction_Type, tp_call)
+
 /* List all methods in a chain -- helper for findmethodinchain */
 
 static PyObject *
@@ -354,7 +374,7 @@
    but it's part of the API so we need to keep a function around that
    existing C extensions can call.
 */
-   
+
 #undef PyCFunction_New
 PyAPI_FUNC(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *);
 

Modified: stackless/trunk/Objects/rangeobject.c
==============================================================================
--- stackless/trunk/Objects/rangeobject.c	(original)
+++ stackless/trunk/Objects/rangeobject.c	Wed Jun 28 15:34:33 2006
@@ -221,7 +221,18 @@
  	{NULL,		NULL}		/* sentinel */
 };
 
+#ifdef STACKLESS
+PyTypeObject PyRangeIter_Type;
+#define Pyrangeiter_Type PyRangeIter_Type
+#else
+  static PyTypeObject Pyrangeiter_Type;
+#endif
+
+#ifdef STACKLESS
+PyTypeObject PyRangeIter_Type = {
+#else
 static PyTypeObject Pyrangeiter_Type = {
+#endif
 	PyObject_HEAD_INIT(&PyType_Type)
 	0,                                      /* ob_size */
 	"rangeiterator",                        /* tp_name */

Modified: stackless/trunk/Objects/typeobject.c
==============================================================================
--- stackless/trunk/Objects/typeobject.c	(original)
+++ stackless/trunk/Objects/typeobject.c	Wed Jun 28 15:34:33 2006
@@ -2,6 +2,7 @@
 
 #include "Python.h"
 #include "structmember.h"
+#include "core/stackless_impl.h"
 
 #include <ctype.h>
 
@@ -87,7 +88,7 @@
 
 	if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) {
 		mod = PyDict_GetItemString(type->tp_dict, "__module__");
-		if (!mod) { 
+		if (!mod) {
 			PyErr_Format(PyExc_AttributeError, "__module__");
 			return 0;
 		}
@@ -830,7 +831,7 @@
 		return 0;
 	}
 	else {
-		/* a is not completely initilized yet; follow tp_base */
+		/* a is not completely initialized yet; follow tp_base */
 		do {
 			if (a == b)
 				return 1;
@@ -892,6 +893,7 @@
 static PyObject *
 call_method(PyObject *o, char *name, PyObject **nameobj, char *format, ...)
 {
+	STACKLESS_GETARG();
 	va_list va;
 	PyObject *args, *func = 0, *retval;
 	va_start(va, format);
@@ -915,7 +917,9 @@
 		return NULL;
 
 	assert(PyTuple_Check(args));
+	STACKLESS_PROMOTE_ALL();
 	retval = PyObject_Call(func, args, NULL);
+	STACKLESS_ASSERT();
 
 	Py_DECREF(args);
 	Py_DECREF(func);
@@ -928,6 +932,7 @@
 static PyObject *
 call_maybe(PyObject *o, char *name, PyObject **nameobj, char *format, ...)
 {
+	STACKLESS_GETARG();
 	va_list va;
 	PyObject *args, *func = 0, *retval;
 	va_start(va, format);
@@ -953,7 +958,9 @@
 		return NULL;
 
 	assert(PyTuple_Check(args));
+	STACKLESS_PROMOTE_ALL();
 	retval = PyObject_Call(func, args, NULL);
+	STACKLESS_ASSERT();
 
 	Py_DECREF(args);
 	Py_DECREF(func);
@@ -1319,7 +1326,7 @@
 		for (i = 0; i < len; i++) {
 			PyTypeObject *t;
 			cls = PyTuple_GET_ITEM(tuple, i);
-			if (PyClass_Check(cls)) 
+			if (PyClass_Check(cls))
 				continue;
 			else if (!PyType_Check(cls)) {
 				PyErr_Format(PyExc_TypeError,
@@ -1718,7 +1725,12 @@
 
 		/* Are slots allowed? */
 		nslots = PyTuple_GET_SIZE(slots);
+#ifdef STACKLESS
+		if (nslots > 0 && base->tp_itemsize != 0 && !PyType_Check(base)) {
+			/* for the special case of meta types, allow slots */
+#else
 		if (nslots > 0 && base->tp_itemsize != 0) {
+#endif
 			PyErr_Format(PyExc_TypeError,
 				     "nonempty __slots__ "
 				     "not supported for subtype of '%s'",
@@ -1992,6 +2004,28 @@
 	/* Put the proper slots in place */
 	fixup_slot_dispatchers(type);
 
+#ifdef STACKLESS
+	/* check if we support stackless call */
+	{
+		PyObject *call;
+		PyTypeObject *tpcheck;
+		static PyObject *call_str;
+
+		if (!call_str) {
+			call_str = PyString_InternFromString("__call__");
+			if (call_str == NULL)
+				return NULL;
+		}
+		if ((call = _PyType_Lookup(type, call_str)) == NULL)
+			goto done;
+		tpcheck = call->ob_type;
+		if (tpcheck == &PyWrapperDescr_Type)
+			tpcheck = ((PyDescrObject *) call)->d_type;
+		if (tpcheck->tp_flags & Py_TPFLAGS_HAVE_STACKLESS_CALL)
+			type->tp_flags |= Py_TPFLAGS_HAVE_STACKLESS_CALL;
+	}
+done:
+#endif
 	return (PyObject *)type;
 }
 
@@ -2974,6 +3008,24 @@
 	(base->SLOT != 0 && \
 	 (basebase == NULL || base->SLOT != basebase->SLOT))
 
+#ifdef STACKLESS
+
+#define COPYSLOT2(SLOT, SLPSLOT) \
+	if (!type->SLOT && SLOTDEFINED(SLOT)) { \
+		type->SLOT = base->SLOT; \
+		if (type->tp_flags & base->tp_flags & \
+			Py_TPFLAGS_HAVE_STACKLESS_EXTENSION) \
+			type->slpflags.SLPSLOT = base->slpflags.SLPSLOT; \
+	}
+
+#define COPYSLOT(SLOT) COPYSLOT2(SLOT, SLOT)
+
+#define COPYNUM(SLOT) COPYSLOT2(tp_as_number->SLOT, SLOT)
+#define COPYSEQ(SLOT) COPYSLOT2(tp_as_sequence->SLOT, SLOT)
+#define COPYMAP(SLOT) COPYSLOT2(tp_as_mapping->SLOT, SLOT)
+#define COPYBUF(SLOT) COPYSLOT2(tp_as_buffer->SLOT, SLOT)
+
+#else
 #define COPYSLOT(SLOT) \
 	if (!type->SLOT && SLOTDEFINED(SLOT)) type->SLOT = base->SLOT
 
@@ -2982,6 +3034,8 @@
 #define COPYMAP(SLOT) COPYSLOT(tp_as_mapping->SLOT)
 #define COPYBUF(SLOT) COPYSLOT(tp_as_buffer->SLOT)
 
+#endif
+
 	/* This won't inherit indirect slots (from tp_as_number etc.)
 	   if type doesn't provide the space. */
 
@@ -3148,6 +3202,16 @@
 
 	type->tp_flags |= Py_TPFLAGS_READYING;
 
+#ifdef STACKLESS
+	/* extract/spread the stackless call flag */
+	if (type->tp_flags & Py_TPFLAGS_HAVE_STACKLESS_EXTENSION) {
+		if (type->slpflags.tp_call)
+			type->tp_flags |= Py_TPFLAGS_HAVE_STACKLESS_CALL;
+		else if (type->tp_flags & Py_TPFLAGS_HAVE_STACKLESS_CALL)
+			type->slpflags.tp_call = -1;
+	}
+#endif
+
 #ifdef Py_TRACE_REFS
 	/* PyType_Ready is the closest thing we have to a choke point
 	 * for type objects, so is the best place I can think of to try
@@ -3363,7 +3427,7 @@
 	if (n == PyTuple_GET_SIZE(ob))
 		return 1;
 	PyErr_Format(
-	    PyExc_TypeError, 
+	    PyExc_TypeError,
 	    "expected %d arguments, got %zd", n, PyTuple_GET_SIZE(ob));
 	return 0;
 }
@@ -4342,7 +4406,7 @@
 }
 
 
-static Py_ssize_t 
+static Py_ssize_t
 slot_nb_index(PyObject *self)
 {
 	static PyObject *index_str;
@@ -4355,7 +4419,7 @@
 		result = temp->ob_type->tp_as_number->nb_index(temp);
 	}
 	else {
-		PyErr_Format(PyExc_TypeError, 
+		PyErr_Format(PyExc_TypeError,
 			     "__index__ must return an int or a long, "
 			     "not '%.200s'", temp->ob_type->tp_name);
 		result = -1;
@@ -4511,12 +4575,15 @@
 static PyObject *
 slot_tp_repr(PyObject *self)
 {
+	STACKLESS_GETARG();
 	PyObject *func, *res;
 	static PyObject *repr_str;
 
 	func = lookup_method(self, "__repr__", &repr_str);
 	if (func != NULL) {
+		STACKLESS_PROMOTE_ALL();
 		res = PyEval_CallObject(func, NULL);
+		STACKLESS_ASSERT();
 		Py_DECREF(func);
 		return res;
 	}
@@ -4528,24 +4595,31 @@
 static PyObject *
 slot_tp_str(PyObject *self)
 {
+	STACKLESS_GETARG();
 	PyObject *func, *res;
 	static PyObject *str_str;
 
 	func = lookup_method(self, "__str__", &str_str);
 	if (func != NULL) {
+		STACKLESS_PROMOTE_ALL();
 		res = PyEval_CallObject(func, NULL);
+		STACKLESS_ASSERT();
 		Py_DECREF(func);
 		return res;
 	}
 	else {
 		PyErr_Clear();
-		return slot_tp_repr(self);
+		STACKLESS_PROMOTE_ALL();
+		res = slot_tp_repr(self);
+		STACKLESS_ASSERT();
+		return res;
 	}
 }
 
 static long
 slot_tp_hash(PyObject *self)
 {
+	STACKLESS_GETARG(); /* not supported */
 	PyObject *func;
 	static PyObject *hash_str, *eq_str, *cmp_str;
 	long h;
@@ -4584,13 +4658,16 @@
 static PyObject *
 slot_tp_call(PyObject *self, PyObject *args, PyObject *kwds)
 {
+	STACKLESS_GETARG();
 	static PyObject *call_str;
 	PyObject *meth = lookup_method(self, "__call__", &call_str);
 	PyObject *res;
 
 	if (meth == NULL)
 		return NULL;
+	STACKLESS_PROMOTE_ALL();
 	res = PyObject_Call(meth, args, kwds);
+	STACKLESS_ASSERT();
 	Py_DECREF(meth);
 	return res;
 }
@@ -4609,14 +4686,21 @@
 static PyObject *
 slot_tp_getattro(PyObject *self, PyObject *name)
 {
+	STACKLESS_GETARG();
 	static PyObject *getattribute_str = NULL;
-	return call_method(self, "__getattribute__", &getattribute_str,
+	PyObject *ret;
+
+	STACKLESS_PROMOTE_ALL();
+	ret = call_method(self, "__getattribute__", &getattribute_str,
 			   "(O)", name);
+	STACKLESS_ASSERT();
+	return ret;
 }
 
 static PyObject *
 slot_tp_getattr_hook(PyObject *self, PyObject *name)
 {
+	STACKLESS_GETARG(); /* partially supported */
 	PyTypeObject *tp = self->ob_type;
 	PyObject *getattr, *getattribute, *res;
 	static PyObject *getattribute_str = NULL;
@@ -4634,10 +4718,13 @@
 			return NULL;
 	}
 	getattr = _PyType_Lookup(tp, getattr_str);
+	STACKLESS_PROMOTE_ALL();
 	if (getattr == NULL) {
 		/* No __getattr__ hook: use a simpler dispatcher */
 		tp->tp_getattro = slot_tp_getattro;
-		return slot_tp_getattro(self, name);
+		res = slot_tp_getattro(self, name);
+		STACKLESS_ASSERT();
+		return res;
 	}
 	getattribute = _PyType_Lookup(tp, getattribute_str);
 	if (getattribute == NULL ||
@@ -4649,14 +4736,17 @@
 		res = PyObject_CallFunctionObjArgs(getattribute, self, name, NULL);
 	if (res == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) {
 		PyErr_Clear();
+		STACKLESS_PROMOTE_ALL();
 		res = PyObject_CallFunctionObjArgs(getattr, self, name, NULL);
 	}
+	STACKLESS_ASSERT();
 	return res;
 }
 
 static int
 slot_tp_setattro(PyObject *self, PyObject *name, PyObject *value)
 {
+	STACKLESS_GETARG(); /* not supported */
 	PyObject *res;
 	static PyObject *delattr_str, *setattr_str;
 
@@ -4685,6 +4775,7 @@
 static PyObject *
 half_richcompare(PyObject *self, PyObject *other, int op)
 {
+	STACKLESS_GETARG();
 	PyObject *func, *args, *res;
 	static PyObject *op_str[6];
 
@@ -4698,7 +4789,9 @@
 	if (args == NULL)
 		res = NULL;
 	else {
+		STACKLESS_PROMOTE_ALL();
 		res = PyObject_Call(func, args, NULL);
+		STACKLESS_ASSERT();
 		Py_DECREF(args);
 	}
 	Py_DECREF(func);
@@ -4708,16 +4801,21 @@
 static PyObject *
 slot_tp_richcompare(PyObject *self, PyObject *other, int op)
 {
+	STACKLESS_GETARG();
 	PyObject *res;
 
 	if (self->ob_type->tp_richcompare == slot_tp_richcompare) {
+		STACKLESS_PROMOTE_ALL();
 		res = half_richcompare(self, other, op);
+		STACKLESS_ASSERT();
 		if (res != Py_NotImplemented)
 			return res;
 		Py_DECREF(res);
 	}
 	if (other->ob_type->tp_richcompare == slot_tp_richcompare) {
+		STACKLESS_PROMOTE_ALL();
 		res = half_richcompare(other, self, _Py_SwappedOp[op]);
+		STACKLESS_ASSERT();
 		if (res != Py_NotImplemented) {
 			return res;
 		}
@@ -4730,6 +4828,7 @@
 static PyObject *
 slot_tp_iter(PyObject *self)
 {
+	STACKLESS_GETARG();
 	PyObject *func, *res;
 	static PyObject *iter_str, *getitem_str;
 
@@ -4738,7 +4837,9 @@
 		PyObject *args;
 		args = res = PyTuple_New(0);
 		if (args != NULL) {
+			STACKLESS_PROMOTE_ALL();
 			res = PyObject_Call(func, args, NULL);
+			STACKLESS_ASSERT();
 			Py_DECREF(args);
 		}
 		Py_DECREF(func);
@@ -4759,16 +4860,24 @@
 static PyObject *
 slot_tp_iternext(PyObject *self)
 {
+	STACKLESS_GETARG();
 	static PyObject *next_str;
-	return call_method(self, "next", &next_str, "()");
+	PyObject *ret;
+
+	STACKLESS_PROMOTE_ALL();
+	ret = call_method(self, "next", &next_str, "()");
+	STACKLESS_ASSERT();
+	return ret;
 }
 
 static PyObject *
 slot_tp_descr_get(PyObject *self, PyObject *obj, PyObject *type)
 {
+	STACKLESS_GETARG();
 	PyTypeObject *tp = self->ob_type;
 	PyObject *get;
 	static PyObject *get_str = NULL;
+	PyObject *ret;
 
 	if (get_str == NULL) {
 		get_str = PyString_InternFromString("__get__");
@@ -4787,12 +4896,16 @@
 		obj = Py_None;
 	if (type == NULL)
 		type = Py_None;
-	return PyObject_CallFunctionObjArgs(get, self, obj, type, NULL);
+	STACKLESS_PROMOTE_ALL();
+	ret = PyObject_CallFunctionObjArgs(get, self, obj, type, NULL);
+	STACKLESS_ASSERT();
+	return ret;
 }
 
 static int
 slot_tp_descr_set(PyObject *self, PyObject *target, PyObject *value)
 {
+	STACKLESS_GETARG(); /* not supported */
 	PyObject *res;
 	static PyObject *del_str, *set_str;
 
@@ -4811,6 +4924,7 @@
 static int
 slot_tp_init(PyObject *self, PyObject *args, PyObject *kwds)
 {
+	STACKLESS_GETARG(); /* not yet supported */
 	static PyObject *init_str;
 	PyObject *meth = lookup_method(self, "__init__", &init_str);
 	PyObject *res;
@@ -4835,6 +4949,7 @@
 static PyObject *
 slot_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
+	STACKLESS_GETARG();
 	static PyObject *new_str;
 	PyObject *func;
 	PyObject *newargs, *x;
@@ -4860,7 +4975,9 @@
 		Py_INCREF(x);
 		PyTuple_SET_ITEM(newargs, i+1, x);
 	}
+	STACKLESS_PROMOTE_ALL();
 	x = PyObject_Call(func, newargs, kwds);
+	STACKLESS_ASSERT();
 	Py_DECREF(newargs);
 	Py_DECREF(func);
 	return x;
@@ -4869,6 +4986,7 @@
 static void
 slot_tp_del(PyObject *self)
 {
+	STACKLESS_GETARG(); /* not supported */
 	static PyObject *del_str = NULL;
 	PyObject *del, *res;
 	PyObject *error_type, *error_value, *error_traceback;
@@ -4950,6 +5068,46 @@
 #undef BINSLOT
 #undef RBINSLOT
 
+#ifdef STACKLESS
+
+#define HEAPOFF(x) offsetof(PyHeapTypeObject, slpflags.x)
+
+#define TPSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
+	{NAME, offsetof(PyTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, \
+	 PyDoc_STR(DOC), 0, 0, HEAPOFF(SLOT)}
+#define FLSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC, FLAGS) \
+	{NAME, offsetof(PyTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, \
+	 PyDoc_STR(DOC), FLAGS, 0, HEAPOFF(SLOT)}
+#define ETSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC, SLPSLOT) \
+	{NAME, offsetof(PyHeapTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, \
+	 PyDoc_STR(DOC), 0, 0, HEAPOFF(SLPSLOT)}
+
+#define SQSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
+	ETSLOT(NAME, as_sequence.SLOT, FUNCTION, WRAPPER, DOC, SLOT)
+#define MPSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
+	ETSLOT(NAME, as_mapping.SLOT, FUNCTION, WRAPPER, DOC, SLOT)
+#define NBSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
+	ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, DOC, SLOT)
+#define UNSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
+	ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, \
+	       "x." NAME "() <==> " DOC, SLOT)
+#define IBSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
+	ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, \
+	       "x." NAME "(y) <==> x" DOC "y", SLOT)
+#define BINSLOT(NAME, SLOT, FUNCTION, DOC) \
+	ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_l, \
+	       "x." NAME "(y) <==> x" DOC "y", SLOT)
+#define RBINSLOT(NAME, SLOT, FUNCTION, DOC) \
+	ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_r, \
+	       "x." NAME "(y) <==> y" DOC "x", SLOT)
+#define BINSLOTNOTINFIX(NAME, SLOT, FUNCTION, DOC) \
+	ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_l, \
+	       "x." NAME "(y) <==> " DOC, SLOT)
+#define RBINSLOTNOTINFIX(NAME, SLOT, FUNCTION, DOC) \
+	ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_r, \
+	       "x." NAME "(y) <==> " DOC, SLOT)
+#else
+
 #define TPSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
 	{NAME, offsetof(PyTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, \
 	 PyDoc_STR(DOC)}
@@ -4959,6 +5117,7 @@
 #define ETSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
 	{NAME, offsetof(PyHeapTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, \
 	 PyDoc_STR(DOC)}
+
 #define SQSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
 	ETSLOT(NAME, as_sequence.SLOT, FUNCTION, WRAPPER, DOC)
 #define MPSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
@@ -4984,6 +5143,8 @@
 	ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_r, \
 	       "x." NAME "(y) <==> " DOC)
 
+#endif
+
 static slotdef slotdefs[] = {
 	SQSLOT("__len__", sq_length, slot_sq_length, wrap_lenfunc,
 	       "x.__len__() <==> len(x)"),
@@ -5093,7 +5254,7 @@
 	       "oct(x)"),
 	UNSLOT("__hex__", nb_hex, slot_nb_hex, wrap_unaryfunc,
 	       "hex(x)"),
-	NBSLOT("__index__", nb_index, slot_nb_index, wrap_lenfunc, 
+	NBSLOT("__index__", nb_index, slot_nb_index, wrap_lenfunc,
 	       "x[y:z] <==> x[y.__index__():z.__index__()]"),
 	IBSLOT("__iadd__", nb_inplace_add, slot_nb_inplace_add,
 	       wrap_binaryfunc, "+"),
@@ -5355,7 +5516,7 @@
 	if (c != 0)
 		return c;
 	else
-		/* Cannot use a-b, as this gives off_t, 
+		/* Cannot use a-b, as this gives off_t,
 		   which may lose precision when converted to int. */
 		return (a > b) ? 1 : (a < b) ? -1 : 0;
 }
@@ -5530,6 +5691,13 @@
 		descr = PyDescr_NewWrapper(type, p, *ptr);
 		if (descr == NULL)
 			return -1;
+#ifdef STACKLESS
+		if (type->tp_flags & Py_TPFLAGS_HAVE_STACKLESS_EXTENSION) {
+			PyWrapperDescrObject * d =
+				(PyWrapperDescrObject *) descr;
+			d->d_slpmask = ((signed char *) type)[p->slp_offset];
+		}
+#endif
 		if (PyDict_SetItem(dict, p->name_strobj, descr) < 0)
 			return -1;
 		Py_DECREF(descr);
@@ -5639,12 +5807,12 @@
 				if (f != NULL) {
 					tmp = f(res,
 						/* Only pass 'obj' param if
-						   this is instance-mode super 
+						   this is instance-mode super
 						   (See SF ID #743627)
 						*/
 						(su->obj == (PyObject *)
-							    su->obj_type 
-							? (PyObject *)NULL 
+							    su->obj_type
+							? (PyObject *)NULL
 							: su->obj),
 						(PyObject *)starttype);
 					Py_DECREF(res);

Modified: stackless/trunk/PC/config.c
==============================================================================
--- stackless/trunk/PC/config.c	(original)
+++ stackless/trunk/PC/config.c	Wed Jun 28 15:34:33 2006
@@ -43,6 +43,9 @@
 extern void initzipimport(void);
 extern void init_random(void);
 extern void inititertools(void);
+#ifdef STACKLESS
+extern void initstackless(void);
+#endif
 extern void initcollections(void);
 extern void init_heapq(void);
 extern void init_bisect(void);

Modified: stackless/trunk/PC/getpathp.c
==============================================================================
--- stackless/trunk/PC/getpathp.c	(original)
+++ stackless/trunk/PC/getpathp.c	Wed Jun 28 15:34:33 2006
@@ -645,8 +645,9 @@
 			/* 'look' will end up one character before the
 			   start of the path in question - even if this
 			   is one character before the start of the buffer
+			   CCP Change: Fix, so that bound check is before dereferencing!
 			*/
-			while (*look != DELIM && look >= module_search_path)
+			while (look >= module_search_path && *look != DELIM)
 				look--;
 			nchars = lookEnd-look;
 			strncpy(lookBuf, look+1, nchars);

Modified: stackless/trunk/PCbuild/_bsddb.vcproj
==============================================================================
--- stackless/trunk/PCbuild/_bsddb.vcproj	(original)
+++ stackless/trunk/PCbuild/_bsddb.vcproj	Wed Jun 28 15:34:33 2006
@@ -4,7 +4,9 @@
 	Version="7.10"
 	Name="_bsddb"
 	SccProjectName="_bsddb"
-	SccLocalPath="..">
+	SccAuxPath=""
+	SccLocalPath=".."
+	SccProvider="MSSCCI:Perforce SCM">
 	<Platforms>
 		<Platform
 			Name="Win32"/>
@@ -20,7 +22,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include;..\PC;&quot;..\..\db-4.4.20\build_win32&quot;"
+				AdditionalIncludeDirectories="..\Include;..\PC;..\Stackless;&quot;..\..\db-4.4.20\build_win32&quot;"
 				PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS"
 				RuntimeLibrary="3"
 				UsePrecompiledHeader="2"
@@ -75,7 +77,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include;..\PC;&quot;..\..\db-4.4.20\build_win32&quot;"
+				AdditionalIncludeDirectories="..\Include;..\PC;..\Stackless;&quot;..\..\db-4.4.20\build_win32&quot;"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -133,7 +135,7 @@
 				AdditionalOptions=" /USECL:MS_ITANIUM"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include;..\PC;&quot;..\..\db-4.4.20\build_win32&quot;"
+				AdditionalIncludeDirectories="..\Include;..\PC;..\Stackless;&quot;..\..\db-4.4.20\build_win32&quot;"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -195,7 +197,7 @@
 				AdditionalOptions=" /USECL:MS_OPTERON /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include;..\PC;&quot;..\..\db-4.4.20\build_win32&quot;"
+				AdditionalIncludeDirectories="..\Include;..\PC;..\Stackless;&quot;..\..\db-4.4.20\build_win32&quot;"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"

Modified: stackless/trunk/PCbuild/_ctypes.vcproj
==============================================================================
--- stackless/trunk/PCbuild/_ctypes.vcproj	(original)
+++ stackless/trunk/PCbuild/_ctypes.vcproj	Wed Jun 28 15:34:33 2006
@@ -19,7 +19,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\_ctypes\libffi_msvc"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\_ctypes\libffi_msvc;..\Stackless"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
 				MinimalRebuild="FALSE"
 				BasicRuntimeChecks="3"
@@ -73,7 +73,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\_ctypes\libffi_msvc"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\_ctypes\libffi_msvc;..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -130,7 +130,7 @@
 				Name="VCCLCompilerTool"
 				AdditionalOptions=" /USECL:MS_OPTERON"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\_ctypes\libffi_msvc"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\_ctypes\libffi_msvc;..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -189,7 +189,7 @@
 				Name="VCCLCompilerTool"
 				AdditionalOptions=" /USECL:MS_ITANIUM"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\_ctypes\libffi_msvc"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\_ctypes\libffi_msvc;..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"

Modified: stackless/trunk/PCbuild/_ctypes_test.vcproj
==============================================================================
--- stackless/trunk/PCbuild/_ctypes_test.vcproj	(original)
+++ stackless/trunk/PCbuild/_ctypes_test.vcproj	Wed Jun 28 15:34:33 2006
@@ -19,7 +19,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
 				MinimalRebuild="FALSE"
 				BasicRuntimeChecks="3"
@@ -71,7 +71,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -126,7 +126,7 @@
 				Name="VCCLCompilerTool"
 				AdditionalOptions=" /USECL:MS_ITANIUM"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
 				MinimalRebuild="FALSE"
 				BasicRuntimeChecks="0"
@@ -181,7 +181,7 @@
 				Name="VCCLCompilerTool"
 				AdditionalOptions=" /USECL:MS_OPTERON"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"

Modified: stackless/trunk/PCbuild/_elementtree.vcproj
==============================================================================
--- stackless/trunk/PCbuild/_elementtree.vcproj	(original)
+++ stackless/trunk/PCbuild/_elementtree.vcproj	Wed Jun 28 15:34:33 2006
@@ -21,7 +21,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat,..\Stackless"
 				PreprocessorDefinitions="_DEBUG;HAVE_EXPAT_H;WIN32;_WINDOWS;XML_NS;XML_DTD;BYTEORDER=1234;XML_CONTEXT_BYTES=1024;USE_PYEXPAT_CAPI;XML_STATIC;HAVE_MEMMOVE"
 				RuntimeLibrary="3"
 				UsePrecompiledHeader="2"
@@ -75,7 +75,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;XML_NS;XML_DTD;BYTEORDER=1234;XML_CONTEXT_BYTES=1024;USE_PYEXPAT_CAPI;XML_STATIC;HAVE_MEMMOVE"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -132,7 +132,7 @@
 				AdditionalOptions=" /USECL:MS_ITANIUM"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;XML_NS;XML_DTD;BYTEORDER=1234;XML_CONTEXT_BYTES=1024;USE_PYEXPAT_CAPI;XML_STATIC;HAVE_MEMMOVE"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -193,7 +193,7 @@
 				AdditionalOptions=" /USECL:MS_OPTERON /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;XML_NS;XML_DTD;BYTEORDER=1234;XML_CONTEXT_BYTES=1024;USE_PYEXPAT_CAPI;XML_STATIC;HAVE_MEMMOVE"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"

Modified: stackless/trunk/PCbuild/_msi.vcproj
==============================================================================
--- stackless/trunk/PCbuild/_msi.vcproj	(original)
+++ stackless/trunk/PCbuild/_msi.vcproj	Wed Jun 28 15:34:33 2006
@@ -22,7 +22,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -77,7 +77,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -132,7 +132,7 @@
 				AdditionalOptions=" /USECL:MS_ITANIUM"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -192,7 +192,7 @@
 				AdditionalOptions=" /USECL:MS_OPTERON /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"

Modified: stackless/trunk/PCbuild/_socket.vcproj
==============================================================================
--- stackless/trunk/PCbuild/_socket.vcproj	(original)
+++ stackless/trunk/PCbuild/_socket.vcproj	Wed Jun 28 15:34:33 2006
@@ -20,7 +20,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS"
 				RuntimeLibrary="3"
 				UsePrecompiledHeader="2"
@@ -74,7 +74,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -131,7 +131,7 @@
 				AdditionalOptions=" /USECL:MS_ITANIUM"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -192,7 +192,7 @@
 				AdditionalOptions=" /USECL:MS_OPTERON /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"

Modified: stackless/trunk/PCbuild/_sqlite3.vcproj
==============================================================================
--- stackless/trunk/PCbuild/_sqlite3.vcproj	(original)
+++ stackless/trunk/PCbuild/_sqlite3.vcproj	Wed Jun 28 15:34:33 2006
@@ -21,7 +21,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include;..\PC;..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\Include;..\PC;..\..\sqlite-source-3.3.4;..\Stackless"
 				PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;MODULE_NAME=\&quot;sqlite3\&quot;"
 				RuntimeLibrary="3"
 				UsePrecompiledHeader="2"
@@ -76,7 +76,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include;..\PC;..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\Include;..\PC;..\..\sqlite-source-3.3.4;..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;MODULE_NAME=\&quot;sqlite3\&quot;"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -134,7 +134,7 @@
 				AdditionalOptions=" /USECL:MS_ITANIUM"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include;..\PC;..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\Include;..\PC;..\..\sqlite-source-3.3.4;..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;MODULE_NAME=\&quot;sqlite3\&quot;"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -196,7 +196,7 @@
 				AdditionalOptions=" /USECL:MS_OPTERON"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include;..\PC;..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\Include;..\PC;..\..\sqlite-source-3.3.4;..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;MODULE_NAME=\&quot;sqlite3\&quot;"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"

Modified: stackless/trunk/PCbuild/_testcapi.vcproj
==============================================================================
--- stackless/trunk/PCbuild/_testcapi.vcproj	(original)
+++ stackless/trunk/PCbuild/_testcapi.vcproj	Wed Jun 28 15:34:33 2006
@@ -22,7 +22,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MMAP_EXPORTS"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -74,7 +74,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MMAP_EXPORTS"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -129,7 +129,7 @@
 				AdditionalOptions=" /USECL:MS_ITANIUM"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MMAP_EXPORTS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -188,7 +188,7 @@
 				AdditionalOptions=" /USECL:MS_OPTERON /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MMAP_EXPORTS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"

Modified: stackless/trunk/PCbuild/_tkinter.vcproj
==============================================================================
--- stackless/trunk/PCbuild/_tkinter.vcproj	(original)
+++ stackless/trunk/PCbuild/_tkinter.vcproj	Wed Jun 28 15:34:33 2006
@@ -21,7 +21,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\..\tcltk\include,..\Include,..\PC"
+				AdditionalIncludeDirectories="..\..\tcltk\include,..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;WITH_APPINIT"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -77,7 +77,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\tcltk\include,..\Include,..\PC"
+				AdditionalIncludeDirectories="..\..\tcltk\include,..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;WITH_APPINIT"
 				RuntimeLibrary="3"
 				UsePrecompiledHeader="2"
@@ -133,7 +133,7 @@
 				AdditionalOptions=" /USECL:MS_ITANIUM"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\..\tcltk\include,..\Include,..\PC"
+				AdditionalIncludeDirectories="..\..\tcltk\include,..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;WITH_APPINIT"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -195,7 +195,7 @@
 				AdditionalOptions=" /USECL:MS_OPTERON /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\..\tcltk\include,..\Include,..\PC"
+				AdditionalIncludeDirectories="..\..\tcltk\include,..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;WITH_APPINIT"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"

Modified: stackless/trunk/PCbuild/bz2.vcproj
==============================================================================
--- stackless/trunk/PCbuild/bz2.vcproj	(original)
+++ stackless/trunk/PCbuild/bz2.vcproj	Wed Jun 28 15:34:33 2006
@@ -21,7 +21,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include,..\PC,..\..\bzip2-1.0.3"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\..\bzip2-1.0.3,..\Stackless"
 				PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS"
 				RuntimeLibrary="3"
 				UsePrecompiledHeader="2"
@@ -79,7 +79,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC,..\..\bzip2-1.0.3"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\..\bzip2-1.0.3,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -140,7 +140,7 @@
 				AdditionalOptions=" /USECL:MS_ITANIUM"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC,..\..\bzip2-1.0.3"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\..\bzip2-1.0.3,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -205,7 +205,7 @@
 				AdditionalOptions=" /USECL:MS_OPTERON /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC,..\..\bzip2-1.0.3"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\..\bzip2-1.0.3,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"

Added: stackless/trunk/PCbuild/compression.py
==============================================================================
--- (empty file)
+++ stackless/trunk/PCbuild/compression.py	Wed Jun 28 15:34:33 2006
@@ -0,0 +1,75 @@
+# cstack compression
+# getting an idea of effectivity
+# Christian Tismer
+# 2002-09-18
+
+import stackless, struct, sys
+
+def get_stack(t):
+	st = t.frame.cstack
+	stack = struct.unpack("%di" % st.size, str(st))
+	return stack
+
+class CStack:
+    def __init__(self, template, values, patches):
+        self.template = template
+        self.values = values
+        self.patches = patches
+
+class Compressor:
+    # template stacks, indexed by size
+    templates = {}
+    # stack patches, indexed by value
+    patches = {}
+
+    def compress(self, cstack):
+        data = get_stack(cstack)
+        template = self.templates.get(len(data))
+        if not template:
+            ret = CStack(data, (), ())
+            self.templates[len(data)] = data
+            return ret
+        values = []
+        patch = []
+        for i in range(len(data)):
+            val = data[i]
+            if template[i] == val:
+                continue
+            try:
+                p = values.index(val)
+            except ValueError:
+                p = len(values)
+                values.append(val)
+            patch.append( (i, p) )
+        patch = tuple(patch)
+        p2 = self.patches.get(patch)
+        if p2:
+            patch = p2
+        else:
+            self.patches[patch] = patch
+        return CStack(template, values, patch)
+
+def test(n=100):
+	global comp
+	comp = Compressor()
+	chan = stackless.channel()
+	def f():
+		chan.send(42)
+	for i in range(n):
+		t = stackless.tasklet(f)()
+		t.run()
+	res = []
+	t = chan.queue
+	for i in range(chan.balance):
+		res.append(comp.compress(t))
+		t = t.next
+	print "Size of uncompressed stack:", len(res[-1].template)
+	print "Size of compressed stack:", len(res[-1].values)
+	print "Number of templates:", len(comp.templates)
+	print "Patch lengths and patterns:"
+	for p in comp.patches:
+		print len(p), p
+
+if __name__ == "__main__":
+	test()
+	
\ No newline at end of file

Added: stackless/trunk/PCbuild/cstack.py
==============================================================================
--- (empty file)
+++ stackless/trunk/PCbuild/cstack.py	Wed Jun 28 15:34:33 2006
@@ -0,0 +1,227 @@
+# Testing compressibility of cstacks
+# Christian Tismer
+# 2002-05-21
+
+import stackless, struct, operator, sys
+
+try:
+	import ccall_map
+except ImportError:
+	sys.path.insert(0, "")
+	try:
+		import ccall_map
+	except ImportError:
+		# platform not supported?
+		pass
+
+g = sys.getrefcount
+
+def get_stack(t):
+	st = t.frame.cstack
+	stack = struct.unpack("%di" % st.size, str(st))
+	return stack
+
+def get_stacks(c):
+	res = []
+	task = c.queue
+	for i in range(abs(c.balance)):
+		res.append(get_stack(task))
+		task = task.next
+	return res
+
+def compress_stacks(stacks):
+	ref = stacks[-1]
+	res = [ref]
+	for stack in stacks[:-1]:
+		compressed = []
+		for i in range(len(stack)):
+			word = stack[i]
+			if word != ref[i]:
+				compressed.extend( [i, word] )
+		res.append(compressed)
+	return res
+
+def stacks_len(stacks):
+	return reduce(operator.add, map(len, stacks))
+
+# checking main task
+ch = stackless.channel()
+def maintest():
+	ch.receive()
+	global look, stackref, tstate
+	t = stackless.getmain()
+	look = get_stack(t)
+	stackref = t.frame.cstack.startaddr
+	try:
+		tstate = stackless._peek(t.frame)
+	except AttributeError:
+		tstate = None
+
+def view_main():
+	g = id(globals())
+	baseadr = stackless._peek(None) - ccall_map.peek_ofs
+	tstate = stackless._peek(sys._getframe())
+	stackend = stackref-4*len(look)
+	context = ''
+	callee = ''
+	codetype = type(sys._getframe().f_code)
+	for i in range(len(look)-1,-1,-1):
+		data = look[i]
+		call = ccall_map.CallMap.get(data-baseadr)
+		if call:
+			(funcname, modname, srcname, lineno, lng, callee) = call
+			if lng:
+				# a function call
+				s = "*%s line %d call %s +%d   file %s" % (funcname, lineno, callee, lng, srcname)
+				s += "\n"+ 60*"-"
+			else:
+				s = "%s line %d entry   file %s" % (funcname, lineno, srcname)
+		elif data == g:
+			s = "--globals--"
+		elif data == tstate:
+			s = "--tstate--"
+		elif data < stackref and data >= stackend:
+			#print "stackref %d data %d" % (stackref, data)
+			sp = (data-stackend)/4
+			s = "-->STACK[%d]" % sp
+		else:
+			x = stackless._peek(data)
+			if x is data:
+				if x > 256:
+					s = "0x%08x" % x
+				else:
+					s = repr(x)
+			else:
+				s = repr(x)[:299]
+				if s[0] <> "<":
+					# add type info
+					tname = str(type(x)).split("'")[1]
+					s = "%s %s" % (tname, repr(x)[:200])
+		print "%-18s [%3d] %s" % (context, i, s)
+		if callee:
+			context = callee
+
+stackless.tasklet(maintest)().run()
+ch.send(1)
+
+def simplefunc(chan):
+	chan.receive()
+	print "back from simplefunc"
+
+def complexfunc(chan):
+	simplefunc(chan)
+
+class worse:
+	def __init__(self, arg):
+		self.data = arg
+	def __add__(self, other):
+		simplefunc(self.data)
+		return 42
+
+def harderfunc(chan):
+	stuff = worse(chan)
+	stuff + 5
+
+def simpletest(func, n):
+	c = stackless.channel()
+	gen = stackless.tasklet(func)
+	for i in range(n):
+		gen(c).run()
+	return c
+
+# simple test
+def test(func):
+	global look, stackref, tstate, t
+	c = simpletest(func, 1)
+	t = c.queue
+	look = get_stack(t)
+	stackref = t.frame.cstack.startaddr
+	tstate = stackless._peek(t.frame)
+	view_main()
+	c.send(0)
+
+def stubtest():
+	global look, stackref, tstate, t
+	t = stackless.taskoutlet(lambda:None)()
+	look = get_stack(t)
+	stackref = t.frame.cstack.startaddr
+	tstate = stackless._peek(t.frame)
+	view_main()
+
+#test(complexfunc)
+#test(simplefunc)
+#test(harderfunc)
+#stubtest()
+
+dump = """
+                   [ 63] *_PyEval_EvalCodeEx line 2613 call _slp_eval_frame +5   file ..\Python\ceval.c
+------------------------------------------------------------
+_slp_eval_frame    [ 62] 0x00c60930
+_slp_eval_frame    [ 61] <code object OnCommand at 00CA4920, file "D:\Python22\Pythonwin\pywin\framework\intpyapp.py", line 68>
+_slp_eval_frame    [ 60] <frame object at 0x00E0FA30>
+_slp_eval_frame    [ 59] *_slp_eval_frame line 627 call _eval_frame +5   file ..\Stackless\stacklesseval.h
+------------------------------------------------------------
+_eval_frame        [ 58] 0		flags
+_eval_frame        [ 57] --tstate--	exc
+_eval_frame        [ 56] -->STACK[48]	tb
+_eval_frame        [ 55] 0		nk
+_eval_frame        [ 54] 0x00e0fb88	freevars
+_eval_frame        [ 53] 0		n, callargs
+_eval_frame        [ 52] <code object 	co	simplefunc at 01285880, file "D:\Stackless\src\2.2\stackless\src\PCbuild\cstack.py", line 106>
+_eval_frame        [ 51] --tstate--	val
+_eval_frame        [ 50] 131		opcode
+_eval_frame        [ 49] --tstate--	tstate
+_eval_frame        [ 48] 0		retval
+_eval_frame        [ 47] 0		stream
+_eval_frame        [ 46] 0x01286304	first_instr
+_eval_frame        [ 45] 0x01286313	next_instr
+_eval_frame        [ 44] 0		why
+_eval_frame        [ 43] 0		err
+_eval_frame        [ 42] 0		oparg
+_eval_frame        [ 41] 0x00e0fb8c	stack_pointer
+_eval_frame        [ 40] <frame object 	ebx		at 0x00C607D0>
+_eval_frame        [ 39] 0		ebp
+_eval_frame        [ 38] 0		esi
+_eval_frame        [ 37] --tstate--	edi
+_eval_frame        [ 36] 0		param na
+_eval_frame        [ 35] -->STACK[41]	param &stack_pointer
+_eval_frame        [ 34] <built-in 	param func		method receive of channel object at 0x01282DF0>
+_eval_frame        [ 33] *_eval_frame line 2035 call _fast_cfunction +5   file ..\Python\ceval.c
+------------------------------------------------------------
+_fast_cfunction    [ 32] 0x00e0fb88
+_fast_cfunction    [ 31] str 'receive'
+_fast_cfunction    [ 30] 0
+_fast_cfunction    [ 29] 0
+_fast_cfunction    [ 28] <channel object at 0x01282DF0>
+_fast_cfunction    [ 27] *_fast_cfunction line 3154 call edi +2   file ..\Python\ceval.c
+------------------------------------------------------------
+edi                [ 26] <channel object at 0x01282DF0>
+edi                [ 25] <built-in method receive of channel object at 0x01282DF0>
+edi                [ 24] str 'receive'
+edi                [ 23] _channel_receive line 336 entry   file ..\Stackless\stacklessmodule.c
+edi                [ 22] 0x00cb6fb8
+edi                [ 21] <tasklet object at 0x0135E9F8>
+edi                [ 20] 0x01282e00
+edi                [ 19] 0x0124f500
+edi                [ 18] <tasklet object at 0x0135E9F8>
+edi                [ 17] *_channel_receive line 365 call _slp_schedule_task +5   file ..\Stackless\stacklessmodule.c
+------------------------------------------------------------
+_slp_schedule_task [ 16] <traceback 	savets.exc_traceback	object at 0x01252478>
+_slp_schedule_task [ 15] str 'There is 	savets.exc_value	no active view.'
+_slp_schedule_task [ 14] str 'win32ui'	savets.exc_type
+_slp_schedule_task [ 13] 1		savets.recursion_depth
+_slp_schedule_task [ 12] <frame object 	savets.frame		at 0x00E0FA30>
+_slp_schedule_task [ 11] <channel 	esi			object at 0x01282DF0>
+_slp_schedule_task [ 10] --tstate--	edi
+_slp_schedule_task [  9] 0x00cb6fb8
+_slp_schedule_task [  8] -->STACK[0]
+_slp_schedule_task [  7] 0x0128ad40
+_slp_schedule_task [  6] --tstate--
+_slp_schedule_task [  5] *_slp_schedule_task line 383 call _slp_transfer +5   file ..\Stackless\stacklesseval.h
+------------------------------------------------------------
+_slp_transfer      [  4] <tasklet object at 0x0135E9F8>
+_slp_transfer      [  3] --tstate--
+_slp_transfer      [  2] <tasklet object at 0x0135E9F8>
+_slp_transfer      [  1] --tstate--
+_slp_transfer      [  0] 0x0124f500
+"""
\ No newline at end of file

Modified: stackless/trunk/PCbuild/make_buildinfo.c
==============================================================================
--- stackless/trunk/PCbuild/make_buildinfo.c	(original)
+++ stackless/trunk/PCbuild/make_buildinfo.c	Wed Jun 28 15:34:33 2006
@@ -81,7 +81,7 @@
 		strcat(command, "getbuildinfo2.c -DSUBWCREV ");
 	else
 		strcat(command, "..\\Modules\\getbuildinfo.c");
-	strcat(command, " -Fogetbuildinfo.o -I..\\Include -I..\\PC");
+	strcat(command, " -Fogetbuildinfo.o -I..\\Include -I..\\PC -I..\\Stackless");
 	puts(command); fflush(stdout);
 	result = system(command);
 	if (do_unlink)

Added: stackless/trunk/PCbuild/mapfile.py
==============================================================================
--- (empty file)
+++ stackless/trunk/PCbuild/mapfile.py	Wed Jun 28 15:34:33 2006
@@ -0,0 +1,376 @@
+###############################################
+## MAP file reader
+## Christian Tismer
+## 2002-06-23 to 25
+##
+## Purpose:
+## first steps towards thread pickling and
+## stack compression. We'd like to get some
+## insight into cstack objects.
+
+"""
+This module tries to gather information about
+the stack layout of the Python interpreter.
+
+From the mapfile, names and addresses of
+public and private functions are collected.
+Additionally, linenumber info is extracted.
+The advantage is that line numbers are provided
+even for include files which produced code.
+The drawback of this approach is, that we get
+addresses of line numbers, but what we really
+need are the expected return addresses on the stack.
+
+This information can be found by parsing the .cod
+files from the assembly. Unfortunately, these files
+give us line numbers as comments, but don't tell us
+the names of the source files. We can find every
+line which contains a call and compute the resulting
+return address.
+By comparing this address with the addresses from the
+.map file's line info, we can also deduce the correct
+source file name.
+"""
+
+import os, re, stackless, bisect, time
+
+if stackless.debug:
+    CODEDIR = "x86-temp-debug\\pythoncore"
+    MAPFILE = CODEDIR + "\\python23_d.map"
+else:
+    CODEDIR = "x86-temp-release\\pythoncore"
+    MAPFILE = "python23.map"
+
+# find the code class
+# determine state
+# generate objects
+
+def makepairs(lis):
+    if len(lis) % 2:
+        raise ValueError, "odd number of elements:" + repr(lis)
+    return [ (lis[i], lis[i+1]) for i in range(0, len(lis), 2) ]
+
+class MapFileReader:
+    
+    def __init__(self, fname):
+        self.fname = fname
+        self.stage = None
+        self.objectfiles = {}
+        self.functions = {}
+        self.funcadr = {}
+        self.alladr = {}
+        self.alladrlis = []
+        self.callmap = {}
+        
+    # we look at the first three words of a header line:
+    # these stages appear in order.
+    # stage 4 is repeated for all source files.
+    stage1 = "Start Length Name".split()
+    stage2 = "Address Publics by".split()
+    stage3 = "Static symbols".split()
+    stage4 = "Line numbers for".split()
+
+    def handle_stage1(self, header, lines):
+        # stage 1: just look for the code segment.
+        # probably always 0001.
+        for line in lines:
+            if len(line)==4:
+                start, length, name, klass = line
+                if klass == "CODE":
+                    seg, ofs = start.split(":")
+                    self.codeseg = seg # keep as string
+                    self.codeofs = int(ofs, 16)
+                    if length[-1] == "H":
+                        length = length[:-1]
+                    self.codelen = int(length, 16)
+                    self.codename = name
+                    break
+    
+    def handle_stage2(self, header, lines, public=True):
+        # stage 2:
+        # find all entries of the form
+        # 0001:00000e50       _init_codecs               1e001e50 f   _codecsmodule.obj
+        codeseg = self.codeseg
+        obfiles = self.objectfiles
+        funcs = self.functions
+        fadr = self.funcadr
+        for line in lines:
+            if len(line)==5:
+                adr, name, absadr, f, obj = line
+                seg, ofs = adr.split(":")
+                if seg == codeseg and f=="f":
+                    ofs = int(ofs, 16)
+                    objfile = obfiles.get(obj, None)
+                    if not objfile:
+                        objfile = Objectfile(obj)
+                        obfiles[obj] = objfile
+                    func = Function(name, ofs, public, objfile)
+                    if public:
+                        funcs[name] = func
+                    else:
+                        # make private names unique
+                        mangled = "%s/%s" % (name, objfile.modname)
+                        funcs[mangled] = func
+                    fadr[ofs] = func
+    
+    def handle_stage3(self, header, lines):
+        # same as stage 2, but not public
+        self.handle_stage2(header, lines, False)
+    
+    def handle_stage4(self, header, lines):
+        # the header is of the form
+        # Line numbers for .\x86-temp-release\pythoncore\_hotshot.obj(D:\Stackless\src\2.2\stackless\src\Modules\_hotshot.c) segment .text
+        info = header[3]
+        path, rest = info.split("(")
+        src, rest = rest.split(")")
+        # prune src path
+        pieces = src.split("\\src\\")
+        if len(pieces) > 1:
+            src = "..\\"+pieces[-1]
+        objname =os.path.basename(path)
+        obj = self.objectfiles[objname]
+        srcfile = Sourcefile(src)
+        obj.sources.append(srcfile)
+        srcfile.objfiles.append(obj)
+        # now process line entries of the form
+        #     96 0001:0001b2a0    98 0001:0001b2c3    99 0001:0001b2e1   100 0001:0001b2ff
+        mp = makepairs
+        fadr = self.funcadr
+        func = None
+        for line in lines:
+            for lineno, adr in mp(line):
+                lineno = int(lineno)
+                seg, ofs = adr.split(":")
+                # assuming seg is codeseg without check
+                ofs = int(ofs, 16)
+                func = fadr.get(ofs, func)
+                lineobj = LineNumber(lineno, ofs, srcfile, func)
+                self.alladr[ofs] = lineobj
+    
+    nextstage = {
+        None         : (stage1, None),
+        tuple(stage1): (stage2, handle_stage1),
+        tuple(stage2): (stage3, handle_stage2),
+        tuple(stage3): (stage4, handle_stage3),
+        tuple(stage4): (stage4, handle_stage4),
+        }
+
+    def do_parse(self):
+        expect_next, handler = self.nextstage[self.stage]
+        start = 0
+        lines = [line.split() for line in file(self.fname).readlines()]
+        for i in range(len(lines)):
+            line = lines[i]
+            if line[:3] == expect_next:
+                if handler:
+                    header = lines[start]
+                    data = lines[start+1:i-1]
+                    handler(self, header, data)
+                start = i
+                self.stage = tuple(expect_next)
+                expect_next, handler = self.nextstage[self.stage]
+        # process last one
+        if handler:
+            header = lines[start]
+            data = lines[start+1:]
+            handler(self, header, data)
+        # now build alladrlis for bisection search
+        lines = self.alladr.items()
+        lines.sort()
+        self.alladrlis = [ value for key, value in lines]
+
+    def get_loadadr(self):
+        # after the initial analysis, we have the
+        # offset of stackless._peek (hopefully),
+        # and we get its absolute address by calling it with None.
+        peek_ofs = self.functions["__peek/stacklessmodule"].ofs
+        peek_adr = stackless._peek(None)
+        self.peek_ofs = peek_ofs
+        self.loadadr = peek_adr - peek_ofs
+
+    def nearest_line(self, ofs):
+        idx = bisect.bisect_left(self.alladrlis, ofs)
+        line = self.alladrlis[idx]
+        if line.ofs >= ofs:
+            line = self.alladrlis[idx-1]
+        return line
+
+    def parse_code(self, verbose=True, single=False):
+        # parse all code files.
+        # find all calls and build our call map.
+        for fname in os.listdir(CODEDIR):
+            if os.path.splitext(fname)[-1] == ".cod":
+                modname = os.path.basename(os.path.splitext(fname)[0])
+                fname = os.path.join(CODEDIR, fname)
+                cp=CodeParser(fname)
+                if verbose: print fname
+                cp.parse()
+                for (ofs, lng, lineno, funcname, callee) in cp.calls:
+                    # find the function by name
+                    mangled = "%s/%s" % (funcname, modname)
+                    func = self.functions.get(mangled)
+                    if not func:
+                        # it is a public
+                        func = self.functions[funcname]
+                    fadr = func.ofs
+                    # find the line number by address
+                    lineadr = fadr + ofs
+                    lineobj = self.nearest_line(lineadr)
+                    # now we have the source file.
+                    srcname = lineobj.srcfile.name
+                    if verbose>1: print "f=%s line=%d, nearest=%d callee=%s" % (
+                        funcname, lineno, lineobj.lineno, callee)
+                    entry = (funcname, modname, srcname, lineno, lng, callee)
+                    self.callmap[lineadr+lng] = entry
+            if single:
+                break
+        self.get_loadadr()
+
+    def make_map(self, fname="ccall_map.py"):
+        calls = self.callmap.items()
+        calls.sort()
+        f = open(fname, "w")
+        print>>f, "# generated at %s" % time.ctime(time.time())
+        print>>f
+        print>>f, "peek_ofs = 0x%05x # relocation" % self.peek_ofs
+        print>>f
+        print>>f, "# Call map"
+        print>>f, "CallMap = {"
+        for ofs, (funcname, modname, srcname, lineno, lng, callee) in calls:
+            tup = ofs, funcname, modname, srcname, lineno, lng, callee
+            fmt = "  0x%05x: ('%s', '%s', r'%s', %d, %d, '%s'),"
+            print>>f, fmt % tup
+        print>>f, "}"
+
+class Objectfile:
+    def __init__(self, name):
+        self.name = name
+        self.sources = []
+        self.modname = os.path.basename(os.path.splitext(name)[0])
+    def __repr__(self):
+        return "<object file %s>" % self.name
+    def __str__(self):
+        return self.name
+
+class Sourcefile:
+    def __init__(self, name):
+        self.name = name
+        self.objfiles = []
+    def __repr__(self):
+        return "<source file %s>" % self.name
+    def __str__(self):
+        return self.name
+        
+class Function:
+    def __init__(self, name, ofs, public, objfile):
+        self.name = name
+        self.ofs = ofs
+        self.public = public
+        self.objfile = objfile
+    def __repr__(self):
+        return "<function %s at %08x (%s)>" % (
+            self.name, self.ofs, ["private", "public"][self.public])
+    def __hash__(self):
+        return self.ofs
+
+class LineNumber(object):
+    __slots__ = "lineno ofs srcfile func".split()
+    def __init__(self, lineno, ofs, srcfile, func):
+        self.lineno = lineno
+        self.ofs = ofs
+        self.srcfile = srcfile
+        self.func = func
+    def __repr__(self):
+        if self.func:
+            funcname = self.func.name
+            funcofs = self.func.ofs
+        else:
+            funcname = "(unknown)"
+            funcofs = -1
+        return "<line %4d of %s at %08x f=%s%s>" % (
+            self.lineno, self.srcfile, self.ofs, funcname,
+            ["", " (entry)"][self.ofs==funcofs])
+    def __hash__(self):
+        return self.ofs
+    def __cmp__(self, other):
+        if type(other) is int:
+            return cmp(self.ofs, other)
+        return cmp(self.ofs, other.ofs)
+
+_nohex_cache = {}
+
+def split_hex_nohex(lis,
+                    _nohex_cache=_nohex_cache,
+                    len=len,
+                    allowed=(2, 5)):
+    """find the first string that is not a valid hex value"""
+    i = 0
+    try:
+        for item in lis:
+            if _nohex_cache[item]: return i
+            i += 1
+        return i
+    except:
+        if len(item) in allowed:
+            try:
+                int(item, 16)
+                _nohex_cache[item] = False
+                return split_hex_nohex(lis)
+            except:
+                _nohex_cache[item] = True
+                return i
+        else:
+            _nohex_cache[item] = True
+        return i
+
+
+class CodeParser:
+    def __init__(self, fname):
+        self.fname = fname
+        self.calls = []
+
+    def parse(self):
+        split_h_nh = split_hex_nohex
+        longline = None
+        for line in file(self.fname).readlines():
+            stuff = line.split()
+            if len(stuff) >= 2:
+                if stuff[0] == ";":
+                    if len(stuff) >=3 and stuff[2] == ":" :
+                        lineno = int(stuff[1])
+                    continue
+                if stuff[1] == "PROC":
+                    funcname = stuff[0]
+                    continue
+                nhex = split_h_nh(stuff)
+                if nhex == len(stuff):
+                    # long code line, concatenate
+                    longline = stuff
+                    continue
+                if longline:
+                    stuff = longline + stuff
+                    nhex += len(longline)
+                    longline = None
+                hexpart = stuff[:nhex]
+                if not hexpart:
+                    continue
+                asmpart = stuff[nhex:]
+                if not asmpart:
+                    continue
+                if asmpart[0] == "call":
+                    ofs = int(hexpart[0], 16)
+                    lng = len(hexpart)-1
+                    callee = " ".join(asmpart[1:])
+                    self.calls.append( (ofs, lng, lineno, funcname, callee) )
+                    continue
+                if hexpart[0] == "00000":
+                    # function entry
+                    self.calls.append( (0, 0, lineno, funcname, "") )
+                    continue
+
+if __name__ == "__main__":
+    mfr = MapFileReader(MAPFILE)
+    mfr.do_parse()
+    mfr.get_loadadr()
+    mfr.parse_code()
+    mfr.make_map()
\ No newline at end of file

Added: stackless/trunk/PCbuild/mkversion.py
==============================================================================
--- (empty file)
+++ stackless/trunk/PCbuild/mkversion.py	Wed Jun 28 15:34:33 2006
@@ -0,0 +1,22 @@
+# create a new stackless version include.
+
+SLP_MAJOR = "3.1b3"
+
+import sys, os, time
+pth, script = os.path.split(sys.argv[0])
+fname = os.path.join(pth, "../Stackless/stackless_version.h")
+
+content = """\
+/*
+ * Stackless Python version string
+ * created at %s by %s
+ */
+
+/* keep this entry up-to-date */
+#define STACKLESS_VERSION "%s %02d%02d%02d"
+"""
+
+y, m, d = time.localtime()[:3]
+tims = time.ctime(time.time())
+file(fname, "w").write(content % (tims, script, SLP_MAJOR, y%100, m, d) )
+                     
\ No newline at end of file

Added: stackless/trunk/PCbuild/psyco.vcproj
==============================================================================
--- (empty file)
+++ stackless/trunk/PCbuild/psyco.vcproj	Wed Jun 28 15:34:33 2006
@@ -0,0 +1,292 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="psyco"
+	ProjectGUID="{96198F1F-0164-43B2-B562-0A545B50E6CA}"
+	SccProjectName="psyco"
+	SccLocalPath="..">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory=".\."
+			IntermediateDirectory=".\x86-temp-release\psyco"
+			ConfigurationType="2"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="FALSE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..\Include;..\PC;&quot;..\..\psyco-1.2\c\i386&quot;;..\Stackless"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;CODE_DUMP=1"
+				StringPooling="TRUE"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="TRUE"
+				UsePrecompiledHeader="2"
+				PrecompiledHeaderThrough=""
+				PrecompiledHeaderFile=".\x86-temp-release\psyco/psyco.pch"
+				AssemblerListingLocation=".\x86-temp-release\psyco/"
+				ObjectFile=".\x86-temp-release\psyco/"
+				ProgramDataBaseFileName=".\x86-temp-release\psyco/"
+				WarningLevel="3"
+				SuppressStartupBanner="TRUE"
+				DebugInformationFormat="1"
+				CompileAs="0"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="odbc32.lib odbccp32.lib"
+				OutputFile="./_psyco.pyd"
+				LinkIncremental="1"
+				SuppressStartupBanner="TRUE"
+				GenerateDebugInformation="TRUE"
+				GenerateMapFile="TRUE"
+				MapExports="TRUE"
+				MapLines="TRUE"
+				SubSystem="2"
+				BaseAddress="0x1e1A0000"
+				ImportLibrary=".\./psyco.lib"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="TRUE"
+				SuppressStartupBanner="TRUE"
+				TargetEnvironment="1"
+				TypeLibraryName=".\./psyco.tlb"
+				HeaderFileName=""/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory=".\."
+			IntermediateDirectory=".\x86-temp-debug\psyco"
+			ConfigurationType="2"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="FALSE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\Include;..\PC;&quot;..\..\psyco-1.2\c\i386&quot;;..\Stackless"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="2"
+				PrecompiledHeaderFile=".\x86-temp-debug\psyco/psyco.pch"
+				AssemblerListingLocation=".\x86-temp-debug\psyco/"
+				ObjectFile=".\x86-temp-debug\psyco/"
+				ProgramDataBaseFileName=".\x86-temp-debug\psyco/"
+				WarningLevel="3"
+				SuppressStartupBanner="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="0"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="odbc32.lib odbccp32.lib"
+				OutputFile="./_psyco_d.pyd"
+				LinkIncremental="1"
+				SuppressStartupBanner="TRUE"
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile=".\./psyco_d.pdb"
+				MapExports="TRUE"
+				MapLines="TRUE"
+				SubSystem="2"
+				BaseAddress="0x1e1A0000"
+				ImportLibrary=".\./psyco_d.lib"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="TRUE"
+				SuppressStartupBanner="TRUE"
+				TargetEnvironment="1"
+				TypeLibraryName=".\./psyco.tlb"
+				HeaderFileName=""/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="i386"
+			Filter="">
+			<File
+				RelativePath="..\..\psyco-1.2\c\i386\idispatcher.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\i386\iencoding.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\i386\iprocessor.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\i386\ipyencoding.c">
+			</File>
+		</Filter>
+		<Filter
+			Name="Modules"
+			Filter="">
+			<File
+				RelativePath="..\..\psyco-1.2\c\Modules\parray.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Modules\pmath.c">
+			</File>
+		</Filter>
+		<Filter
+			Name="Objects"
+			Filter="">
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\pabstract.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\pboolobject.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\pclassobject.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\pdescrobject.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\pdictobject.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\pfloatobject.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\pfuncobject.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\pintobject.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\piterobject.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\plistobject.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\plongobject.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\pmethodobject.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\pobject.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\prangeobject.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\pstringobject.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\pstructmember.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\ptupleobject.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Objects\ptypeobject.c">
+			</File>
+		</Filter>
+		<Filter
+			Name="Python"
+			Filter="">
+			<File
+				RelativePath="..\..\psyco-1.2\c\Python\frames.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Python\pbltinmodule.c">
+			</File>
+			<File
+				RelativePath="..\..\psyco-1.2\c\Python\pycompiler.c">
+			</File>
+		</Filter>
+		<File
+			RelativePath="..\..\psyco-1.2\c\alarm.c">
+		</File>
+		<File
+			RelativePath="..\..\psyco-1.2\c\codegen.c">
+		</File>
+		<File
+			RelativePath="..\..\psyco-1.2\c\codemanager.c">
+		</File>
+		<File
+			RelativePath="..\..\psyco-1.2\c\cstruct.c">
+		</File>
+		<File
+			RelativePath="..\..\psyco-1.2\c\dispatcher.c">
+		</File>
+		<File
+			RelativePath="..\..\psyco-1.2\c\linuxmemchk.c">
+		</File>
+		<File
+			RelativePath="..\..\psyco-1.2\c\mergepoints.c">
+		</File>
+		<File
+			RelativePath="..\..\psyco-1.2\c\profile.c">
+		</File>
+		<File
+			RelativePath="..\..\psyco-1.2\c\psyco.c">
+		</File>
+		<File
+			RelativePath="..\..\psyco-1.2\c\psyfunc.c">
+		</File>
+		<File
+			RelativePath="..\..\psyco-1.2\c\stats.c">
+		</File>
+		<File
+			RelativePath="..\..\psyco-1.2\c\vcompiler.c">
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Added: stackless/trunk/PCbuild/publish_binaries.py
==============================================================================
--- (empty file)
+++ stackless/trunk/PCbuild/publish_binaries.py	Wed Jun 28 15:34:33 2006
@@ -0,0 +1,48 @@
+from zipfile import *
+import os, sys, md5
+
+exp_path = r"..\..\binaries-pc"
+
+prog = """
+import md5
+expected = "%s"
+fname = r"%s"
+print "expected digest", expected
+received = md5.md5(file(fname, "rb").read()).hexdigest()
+print ("matched", "NOT MATCHED!!") [received != expected]
+raw_input("press enter to continue")
+"""
+
+fileList = [ r"..\Lib\copy_reg.py", r"..\Lib\pickle.py" ]
+for debug in ("", "_d"):
+    for suffix in ("dll", "lib", "exp"):
+        fileList.append("python24%s.%s" % (debug, suffix))
+
+pathBySuffix = {
+    "dll":  "",
+    "lib":  "libs/",
+    "exp":  "libs/",
+    "py":   "Lib/",
+}
+
+
+zname = os.path.join(exp_path, "python24.zip")
+z = ZipFile(zname, "w", ZIP_DEFLATED)
+for fileName in fileList:
+    if os.path.exists(fileName):
+        suffix = fileName[fileName.rfind(".")+1:]
+        s = open(fileName, "rb").read()
+        z.writestr(pathBySuffix[suffix] + os.path.basename(fileName), s)
+    else:
+        print "File not found:", fileName
+z.close()
+
+signame = zname+".md5.py"
+expected = md5.md5(file(zname, "rb").read()).hexdigest()
+shortname = os.path.split(zname)[-1]
+file(signame, "w").write(prog % (expected, shortname))
+
+# generate a reST include for upload time.
+#import time
+#txt = ".. |uploaded| replace:: " + time.ctime()
+#print >> file(os.path.join(exp_path, "uploaded.txt"), "w"), txt

Modified: stackless/trunk/PCbuild/pyexpat.vcproj
==============================================================================
--- stackless/trunk/PCbuild/pyexpat.vcproj	(original)
+++ stackless/trunk/PCbuild/pyexpat.vcproj	Wed Jun 28 15:34:33 2006
@@ -20,7 +20,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat,..\Stackless"
 				PreprocessorDefinitions="_DEBUG;HAVE_EXPAT_H;WIN32;_WINDOWS;XML_NS;XML_DTD;BYTEORDER=1234;XML_CONTEXT_BYTES=1024;XML_STATIC;HAVE_MEMMOVE"
 				RuntimeLibrary="3"
 				UsePrecompiledHeader="2"
@@ -74,7 +74,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;XML_NS;XML_DTD;BYTEORDER=1234;XML_CONTEXT_BYTES=1024;XML_STATIC;HAVE_MEMMOVE"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -131,7 +131,7 @@
 				AdditionalOptions=" /USECL:MS_ITANIUM"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;XML_NS;XML_DTD;BYTEORDER=1234;XML_CONTEXT_BYTES=1024;XML_STATIC;HAVE_MEMMOVE"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -192,7 +192,7 @@
 				AdditionalOptions=" /USECL:MS_OPTERON"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;XML_NS;XML_DTD;BYTEORDER=1234;XML_CONTEXT_BYTES=1024;XML_STATIC;HAVE_MEMMOVE"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"

Modified: stackless/trunk/PCbuild/python.vcproj
==============================================================================
--- stackless/trunk/PCbuild/python.vcproj	(original)
+++ stackless/trunk/PCbuild/python.vcproj	Wed Jun 28 15:34:33 2006
@@ -22,7 +22,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -80,7 +80,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
 				RuntimeLibrary="3"
 				UsePrecompiledHeader="2"
@@ -140,7 +140,7 @@
 				AdditionalOptions=" /USECL:MS_ITANIUM /VSEXTCOMP_VERBOSE"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -204,7 +204,7 @@
 				AdditionalOptions=" /USECL:MS_OPTERON"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"

Modified: stackless/trunk/PCbuild/pythoncore.vcproj
==============================================================================
--- stackless/trunk/PCbuild/pythoncore.vcproj	(original)
+++ stackless/trunk/PCbuild/pythoncore.vcproj	Wed Jun 28 15:34:33 2006
@@ -24,7 +24,7 @@
 				AdditionalOptions="/Zm200 "
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;USE_DL_EXPORT"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -86,7 +86,7 @@
 				Name="VCCLCompilerTool"
 				AdditionalOptions="/Zm200 "
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="_DEBUG;USE_DL_EXPORT;WIN32;_WINDOWS"
 				RuntimeLibrary="3"
 				UsePrecompiledHeader="2"
@@ -147,7 +147,7 @@
 				AdditionalOptions=" /USECL:MS_ITANIUM"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;USE_DL_EXPORT"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -214,7 +214,7 @@
 				AdditionalOptions="/Zm200  /USECL:MS_OPTERON /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;USE_DL_EXPORT"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -340,6 +340,122 @@
 				RelativePath="..\Modules\zlib\zutil.c">
 			</File>
 		</Filter>
+		<Filter
+			Name="stackless"
+			Filter="">
+			<File
+				RelativePath="..\Stackless\readme.txt">
+			</File>
+			<File
+				RelativePath="..\Stackless\stackless.h">
+			</File>
+			<File
+				RelativePath="..\Stackless\stackless_api.h">
+			</File>
+			<File
+				RelativePath="..\Stackless\stackless_version.h">
+			</File>
+			<Filter
+				Name="module"
+				Filter="">
+				<File
+					RelativePath="..\Stackless\core\backwardcompat.h">
+				</File>
+				<File
+					RelativePath="..\Stackless\module\channelobject.c">
+				</File>
+				<File
+					RelativePath="..\Stackless\module\channelobject.h">
+				</File>
+				<File
+					RelativePath="..\Stackless\module\flextype.c">
+				</File>
+				<File
+					RelativePath="..\Stackless\module\flextype.h">
+				</File>
+				<File
+					RelativePath="..\Stackless\module\scheduling.c">
+				</File>
+				<File
+					RelativePath="..\Stackless\module\stacklessmodule.c">
+				</File>
+				<File
+					RelativePath="..\Stackless\module\taskletobject.c">
+				</File>
+				<File
+					RelativePath="..\Stackless\module\taskletobject.h">
+				</File>
+			</Filter>
+			<Filter
+				Name="core"
+				Filter="">
+				<File
+					RelativePath="..\Stackless\core\cframeobject.c">
+				</File>
+				<File
+					RelativePath="..\Stackless\core\slp_transfer.c">
+				</File>
+				<File
+					RelativePath="..\Stackless\core\stackless_impl.h">
+				</File>
+				<File
+					RelativePath="..\Stackless\core\stackless_methods.h">
+				</File>
+				<File
+					RelativePath="..\Stackless\core\stackless_structs.h">
+				</File>
+				<File
+					RelativePath="..\Stackless\core\stackless_tstate.h">
+				</File>
+				<File
+					RelativePath="..\Stackless\core\stackless_util.c">
+				</File>
+				<File
+					RelativePath="..\Stackless\core\stacklesseval.c">
+				</File>
+			</Filter>
+			<Filter
+				Name="platf"
+				Filter="">
+				<File
+					RelativePath="..\Stackless\platf\slp_platformselect.h">
+				</File>
+				<File
+					RelativePath="..\Stackless\platf\switch_ppc_macosx.h">
+				</File>
+				<File
+					RelativePath="..\Stackless\platf\switch_ppc_unix.h">
+				</File>
+				<File
+					RelativePath="..\Stackless\platf\switch_s390_unix.h">
+				</File>
+				<File
+					RelativePath="..\Stackless\platf\switch_sparc_sun_gcc.h">
+				</File>
+				<File
+					RelativePath="..\Stackless\platf\switch_x64_msvc.h">
+				</File>
+				<File
+					RelativePath="..\Stackless\platf\switch_x86_msvc.h">
+				</File>
+				<File
+					RelativePath="..\Stackless\platf\switch_x86_unix.h">
+				</File>
+			</Filter>
+			<Filter
+				Name="pickling"
+				Filter="">
+				<File
+					RelativePath="..\Stackless\pickling\prickelpit.c">
+				</File>
+				<File
+					RelativePath="..\Stackless\pickling\prickelpit.h">
+				</File>
+				<File
+					RelativePath="..\Stackless\pickling\safe_pickle.c">
+				</File>
+			</Filter>
+		</Filter>
 		<File
 			RelativePath="..\Modules\_bisectmodule.c">
 		</File>

Modified: stackless/trunk/PCbuild/pythonw.vcproj
==============================================================================
--- stackless/trunk/PCbuild/pythonw.vcproj	(original)
+++ stackless/trunk/PCbuild/pythonw.vcproj	Wed Jun 28 15:34:33 2006
@@ -20,7 +20,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
 				RuntimeLibrary="3"
 				UsePrecompiledHeader="2"
@@ -75,7 +75,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -133,7 +133,7 @@
 				AdditionalOptions=" /USECL:MS_ITANIUM"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -195,7 +195,7 @@
 				AdditionalOptions=" /USECL:MS_OPTERON"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"

Added: stackless/trunk/PCbuild/schedtest.py
==============================================================================
--- (empty file)
+++ stackless/trunk/PCbuild/schedtest.py	Wed Jun 28 15:34:33 2006
@@ -0,0 +1,55 @@
+from stackless import *
+
+test_exception = 0
+
+ch = channel()
+
+def f1(n):
+    print "f1 called"
+    for i in xrange(n):
+        #print "f1", i
+        if i == 4:
+            if test_exception:
+                1/0
+        if i % 100 == 0:
+            schedule()
+
+def f2(n):
+    print "f2 called"
+    for i in xrange(n):
+        #print "f2", i
+        if i % 100 == 0:
+            schedule()
+
+def tt(n, timeout):
+    t1 = tasklet(f1)(n)
+    t2 = tasklet(f2)(n)
+    t1.insert()
+    t2.insert()
+    global victim
+    victim = run_watchdog(timeout)
+    # print"*ick*"
+    # do not print, this kills PyWin.
+    # also re-insert and let it finish!
+    victim.run()
+
+tt(10, 100)
+if victim:
+    print "Watchdog was called"
+    print victim
+    
+
+def infinite():
+    global count
+    count = 0
+    while 1:
+        count += 1
+
+def test_inf(limit):
+    print "calling infinite"
+    tasklet(infinite)().insert()
+    victim = run_watchdog(limit)
+    if victim:
+        print "gotcha!"
+    print "%d reached after %d iterations." % (limit, count)
+    
\ No newline at end of file

Modified: stackless/trunk/PCbuild/select.vcproj
==============================================================================
--- stackless/trunk/PCbuild/select.vcproj	(original)
+++ stackless/trunk/PCbuild/select.vcproj	Wed Jun 28 15:34:33 2006
@@ -21,7 +21,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -77,7 +77,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS"
 				RuntimeLibrary="3"
 				UsePrecompiledHeader="2"
@@ -133,7 +133,7 @@
 				AdditionalOptions=" /USECL:MS_ITANIUM"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -195,7 +195,7 @@
 				AdditionalOptions=" /USECL:MS_OPTERON"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"

Modified: stackless/trunk/PCbuild/unicodedata.vcproj
==============================================================================
--- stackless/trunk/PCbuild/unicodedata.vcproj	(original)
+++ stackless/trunk/PCbuild/unicodedata.vcproj	Wed Jun 28 15:34:33 2006
@@ -22,7 +22,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MMAP_EXPORTS"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -74,7 +74,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MMAP_EXPORTS"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -129,7 +129,7 @@
 				AdditionalOptions=" /USECL:MS_ITANIUM"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MMAP_EXPORTS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -188,7 +188,7 @@
 				AdditionalOptions=" /USECL:MS_OPTERON /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MMAP_EXPORTS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"

Added: stackless/trunk/PCbuild/uthread_ccp.py
==============================================================================
--- (empty file)
+++ stackless/trunk/PCbuild/uthread_ccp.py	Wed Jun 28 15:34:33 2006
@@ -0,0 +1,253 @@
+"""Python Microthread Library, version 0.1
+Microthreads are useful when you want to program many behaviors
+happening simultaneously. Simulations and games often want to model
+the simultaneous and independent behavior of many people, many
+businesses, many monsters, many physical objects, many spaceships, and
+so forth. With microthreads, you can code these behaviors as Python
+functions. Microthreads use Stackless Python. For more details, see
+http://world.std.com/~wware/uthread.html"""
+
+__version__ = "0.1"
+
+__license__ = \
+"""Python Microthread Library version 0.1
+Copyright (C)2000  Will Ware, Christian Tismer
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of the authors not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+WILL WARE AND CHRISTIAN TISMER DISCLAIM ALL WARRANTIES WITH REGARD TO
+THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL WILL WARE OR CHRISTIAN TISMER BE LIABLE FOR
+ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE."""
+
+#import continuation
+import stackless
+
+MAX_TIMESLICE = 20000000
+
+'''
+tasks = [ ]
+ghandler = None
+'''
+
+'''
+def endtask():
+    """force this thread to die"""
+    continuation.uthread_lock(1)
+    sched = continuation.uthread_reset()
+    if sched != None:
+        sched()
+'''
+# not needed yet
+
+'''
+def schedule():
+    """force a context switch"""
+    continuation.uthread_lock(1)
+    sched = continuation.uthread_reset()
+    sched(continuation.caller())
+'''
+# handled internally
+schedule = stackless.schedule
+
+'''
+def new(func, *args, **kw):
+    """Start a new task"""
+    if func == None:
+        raise "Don't you make me try to call None"
+    global tasks
+    assert not kw
+
+    def wrapper(func, args):
+        continuation.return_current()
+        try:
+            apply(func, args)
+        except:
+            continuation.uthread_reset()
+            raise
+        endtask()
+
+    tmp = continuation.uthread_lock(1)
+    task = wrapper(func, args)
+    task.caller = None
+    tasks.append(task)
+    continuation.uthread_lock(tmp)
+'''
+def new(func, *args, **kw):
+    """Start a new task"""
+    gen = stackless.taskoutlet(func)
+    t = gen(*args, **kw)
+    t.insert()
+
+'''
+def run():
+    """Run a bunch of tasks, until they all complete"""
+    global tasks
+    pop = tasks.pop
+    append = tasks.append
+    timeslice = continuation.timeslice
+    if not tasks:
+        # just enter the loop
+        append(None)
+    while tasks:
+        task = pop(0)
+        if task:
+            try:
+                task = timeslice(task, MAX_TIMESLICE)
+            except UserError, e:
+                global ghandler
+                if ghandler:
+                    new(ghandler, e)
+                else:
+                    print e
+
+        if task:
+            import runner
+            runner.PostException(
+                task,
+                "THIS THREAD WAS PROBABLY STUCK IN AN INFINITE LOOP AND HAS BEEN NUKED!!!",
+                None)
+
+            #append(task)
+'''
+def run():
+    """Run a bunch of tasks, until they all complete"""
+    # have to add error handling like above
+    while stackless.getruncount() > 1:
+        try:
+            # running until the end or until something happens
+            victim = stackless.run_watchdog(MAX_TIMESLICE)
+            if victim:
+                print "THIS THREAD WAS PROBABLY STUCK IN AN INFINITE LOOP AND HAS BEEN NUKED!!!",
+            # todo: kill the task cleanly
+        except Exception, e:
+            print "Exception occoured:", e
+
+idIndex = 0
+
+def sethandler(handler):
+    global ghandler
+    ghandler = handler
+
+
+def uniqueId():
+    """Microthread-safe way to get unique numbers, handy for
+    giving things unique ID numbers"""
+    global idIndex
+    tmp = stackless.scheduler_lock(1)
+    z = idIndex
+    idIndex = z + 1
+    stackless.scheduler_lock(tmp)
+    return z
+
+def irandom(n):
+    """Microthread-safe version of random.randrange(0,n)"""
+    import random
+    tmp = stackless.scheduler_lock(1)
+    n = random.randrange(0, n)
+    stackless.scheduler_lock(tmp)
+    return n
+
+'''
+class Semaphore:
+    """Semaphores protect globally accessible resources from
+    the effects of context switching."""
+    __guid__ = 'uthread.Semaphore'
+    def __init__(self, maxcount=1):
+        self.count = maxcount
+        self.waiting = []
+    def claim(self):
+        tmp = continuation.uthread_lock(1)
+        if self.count == 0:
+            self.waiting.append(continuation.caller())
+            endtask()
+        else:
+            self.count = self.count - 1
+            continuation.uthread_lock(tmp)
+    def release(self):
+        tmp = continuation.uthread_lock(1)
+        if self.waiting:
+            tasks.append(self.waiting.pop(0))
+        else:
+            self.count = self.count + 1
+        continuation.uthread_lock(tmp)
+'''
+
+class Semaphore:
+    """Semaphores protect globally accessible resources from
+    the effects of context switching."""
+    __guid__ = 'uthread_ccp.Semaphore'
+    
+    def __init__(self, maxcount=1):
+        self.count = maxcount
+        self.waiting = stackless.channel()
+        
+    def acquire(self):
+        tmp = stackless.atomic()
+        if self.count == 0:
+            self.waiting.receive()
+        else:
+            self.count = self.count - 1
+            
+    claim = acquire
+    
+    def release(self):
+        tmp = stackless.atomic()
+        if self.waiting.queue:
+            self.waiting.send(None)
+        else:
+            self.count = self.count + 1
+
+class Queue:
+    """A queue is a microthread-safe FIFO."""
+    __guid__ = 'uthread_ccp.Queue'
+    
+    def __init__(self):
+        self.contents = [ ]
+        self.channel = stackless.channel()
+        
+    def put(self, x):
+        tmp = stackless.atomic()
+        self.contents.append(x)
+        while self.channel.queue and self.contents:
+            self.channel.send(self.contents.pop(0))
+        
+    def get(self):
+        tmp = stackless.atomic()
+        if self.contents:
+            return self.contents.pop(0)
+        return self.channel.receive()
+            
+    def unget(self, x):
+        tmp = stackless.atomic()
+        self.contents.insert(0, x)
+        
+    def cget(self):
+        return self.contents.pop(0)
+
+
+exports = {
+    "uthread_ccp.new":          new,
+    "uthread_ccp.irandom":      irandom,
+    "uthread_ccp.uniqueId":     uniqueId,
+    "uthread_ccp.run":          run,
+    "uthread_ccp.schedule":     schedule,
+    "uthread_ccp.sethandler":   sethandler,
+    }
+    
+def test(n):
+    global cnt
+    for cnt in xrange(n):
+        if cnt == 12345:
+            1/0
+            
+            
\ No newline at end of file

Modified: stackless/trunk/PCbuild/winsound.vcproj
==============================================================================
--- stackless/trunk/PCbuild/winsound.vcproj	(original)
+++ stackless/trunk/PCbuild/winsound.vcproj	Wed Jun 28 15:34:33 2006
@@ -21,7 +21,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;WINSOUND_EXPORTS"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -76,7 +76,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;WINSOUND_EXPORTS"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -131,7 +131,7 @@
 				AdditionalOptions=" /USECL:MS_ITANIUM"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;WINSOUND_EXPORTS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"
@@ -191,7 +191,7 @@
 				AdditionalOptions=" /USECL:MS_OPTERON /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\Include,..\PC"
+				AdditionalIncludeDirectories="..\Include,..\PC,..\Stackless"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;WINSOUND_EXPORTS"
 				StringPooling="TRUE"
 				BasicRuntimeChecks="0"

Modified: stackless/trunk/Python/bltinmodule.c
==============================================================================
--- stackless/trunk/Python/bltinmodule.c	(original)
+++ stackless/trunk/Python/bltinmodule.c	Wed Jun 28 15:34:33 2006
@@ -2,6 +2,8 @@
 
 #include "Python.h"
 
+#include "core/stackless_impl.h"
+
 #include "node.h"
 #include "code.h"
 #include "eval.h"
@@ -524,6 +526,7 @@
 static PyObject *
 builtin_eval(PyObject *self, PyObject *args)
 {
+	STACKLESS_GETARG();
 	PyObject *cmd, *result, *tmp = NULL;
 	PyObject *globals = Py_None, *locals = Py_None;
 	char *str;
@@ -568,6 +571,7 @@
 		"code object passed to eval() may not contain free variables");
 			return NULL;
 		}
+		STACKLESS_PROMOTE_ALL();
 		return PyEval_EvalCode((PyCodeObject *) cmd, globals, locals);
 	}
 
@@ -596,7 +600,9 @@
 		str++;
 
 	(void)PyEval_MergeCompilerFlags(&cf);
+	STACKLESS_PROMOTE_ALL();
 	result = PyRun_StringFlags(str, Py_eval_input, globals, locals, &cf);
+	STACKLESS_ASSERT();
 	Py_XDECREF(tmp);
 	return result;
 }
@@ -615,6 +621,7 @@
 static PyObject *
 builtin_execfile(PyObject *self, PyObject *args)
 {
+	STACKLESS_GETARG();
 	char *filename;
 	PyObject *globals = Py_None, *locals = Py_None;
 	PyObject *res;
@@ -696,12 +703,14 @@
 		return NULL;
 	}
 	cf.cf_flags = 0;
+	STACKLESS_PROMOTE_ALL();
 	if (PyEval_MergeCompilerFlags(&cf))
 		res = PyRun_FileExFlags(fp, filename, Py_file_input, globals,
 				   locals, 1, &cf);
 	else
 		res = PyRun_FileEx(fp, filename, Py_file_input, globals,
 				   locals, 1);
+	STACKLESS_ASSERT();
 	return res;
 }
 
@@ -2239,8 +2248,15 @@
  	{"delattr",	builtin_delattr,    METH_VARARGS, delattr_doc},
  	{"dir",		builtin_dir,        METH_VARARGS, dir_doc},
  	{"divmod",	builtin_divmod,     METH_VARARGS, divmod_doc},
+#ifdef STACKLESS
+ 	{"eval",	builtin_eval,       METH_VARARGS | METH_STACKLESS,
+	 eval_doc},
+	{"execfile",	builtin_execfile,   METH_VARARGS | METH_STACKLESS,
+	 execfile_doc},
+#else
  	{"eval",	builtin_eval,       METH_VARARGS, eval_doc},
  	{"execfile",	builtin_execfile,   METH_VARARGS, execfile_doc},
+#endif
  	{"filter",	builtin_filter,     METH_VARARGS, filter_doc},
  	{"getattr",	builtin_getattr,    METH_VARARGS, getattr_doc},
  	{"globals",	(PyCFunction)builtin_globals,    METH_NOARGS, globals_doc},

Modified: stackless/trunk/Python/ceval.c
==============================================================================
--- stackless/trunk/Python/ceval.c	(original)
+++ stackless/trunk/Python/ceval.c	Wed Jun 28 15:34:33 2006
@@ -16,6 +16,8 @@
 #include "eval.h"
 #include "opcode.h"
 #include "structmember.h"
+#include "core/stackless_impl.h"
+#include "platf/slp_platformselect.h" /* for stack saving */
 
 #include <ctype.h>
 
@@ -502,6 +504,31 @@
 
 /* Interpreter main loop */
 
+#ifdef STACKLESS
+PyObject *
+PyEval_EvalFrame(PyFrameObject *f)
+{
+	return PyEval_EvalFrameEx_slp(f, 0, NULL);
+}
+
+PyObject *
+PyEval_EvalFrame_slp(PyFrameObject *f, int throwflag, PyObject *retval)
+{
+	return PyEval_EvalFrameEx_slp(f, throwflag, NULL);
+}
+
+PyObject *
+PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
+{
+	return PyEval_EvalFrameEx_slp(f, throwflag, NULL);
+}
+
+PyObject *
+PyEval_EvalFrameEx_slp(PyFrameObject *f, int throwflag, PyObject *retval)
+{
+	PyThreadState *tstate = PyThreadState_GET();
+#else
+
 PyObject *
 PyEval_EvalFrame(PyFrameObject *f) {
 	/* This is for backward compatibility with extension modules that
@@ -549,6 +576,8 @@
 	char *filename;
 #endif
 
+#endif  /* not STACKLESS */
+
 /* Tuple access macros */
 
 #ifndef Py_DEBUG
@@ -636,6 +665,18 @@
 #define PREDICTED(op)		PRED_##op: next_instr++
 #define PREDICTED_WITH_ARG(op)	PRED_##op: oparg = PEEKARG(); next_instr += 3
 
+#ifdef STACKLESS
+#ifdef STACKLESS_USE_ENDIAN
+
+#undef NEXTARG
+#define NEXTARG()	(next_instr += 2, ((unsigned short *)next_instr)[-1])
+#undef PREDICTED_WITH_ARG
+#define PREDICTED_WITH_ARG(op)	PRED_##op: next_instr += 3;  \
+				oparg = ((unsigned short *)next_instr)[-1]
+
+#endif
+#endif
+
 /* Stack manipulation macros */
 
 /* The stack can grow at most MAXINT deep, as co_nlocals and
@@ -689,9 +730,22 @@
 	if (f == NULL)
 		return NULL;
 
+#ifdef STACKLESS
+	if (CSTACK_SAVE_NOW(tstate, f))
+		return slp_eval_frame_newstack(f, throwflag, retval);
+
+	/* push frame */
+	if (Py_EnterRecursiveCall("")) {
+	    Py_XDECREF(retval);
+		tstate->frame = f->f_back;
+		Py_DECREF(f);
+		return NULL;
+	}
+#else
 	/* push frame */
 	if (Py_EnterRecursiveCall(""))
 		return NULL;
+#endif /* STACKLESS */
 
 	tstate->frame = f;
 
@@ -728,6 +782,81 @@
 		}
 	}
 
+#ifdef STACKLESS
+
+	f->f_execute = PyEval_EvalFrame_noval;
+	return PyEval_EvalFrame_value(f, throwflag, retval);
+exit_eval_frame:
+	Py_LeaveRecursiveCall();
+	tstate->frame = f->f_back;
+	return NULL;
+}
+
+PyObject *
+PyEval_EvalFrame_noval(PyFrameObject *f, int throwflag, PyObject *retval)
+{
+	/*
+	 * this function is identical to PyEval_EvalFrame_value.
+	 * it serves as a marker whether we expect a value or
+	 * not, and it makes debugging a little easier.
+	 */
+	return PyEval_EvalFrame_value(f, throwflag, retval);
+}
+
+PyObject *
+PyEval_EvalFrame_iter(PyFrameObject *f, int throwflag, PyObject *retval)
+{
+	/*
+	 * this function is identical to PyEval_EvalFrame_value.
+	 * it serves as a marker whether we are inside of a
+	 * for_iter operation. In this case we need to handle
+	 * null without error as valid result.
+	 */
+	return PyEval_EvalFrame_value(f, throwflag, retval);
+}
+
+PyObject *
+PyEval_EvalFrame_value(PyFrameObject *f, int throwflag, PyObject *retval)
+{
+	/* unfortunately we repeat all the variables here... */
+#ifdef DXPAIRS
+	int lastopcode = 0;
+#endif
+	register PyObject **stack_pointer;   /* Next free slot in value stack */
+	register unsigned char *next_instr;
+	register int opcode;	/* Current opcode */
+	register int oparg;	/* Current opcode argument, if any */
+	register enum why_code why; /* Reason for block stack unwind */
+	register int err;	/* Error status -- nonzero if error */
+	register PyObject *x;	/* Result object -- NULL if error */
+	register PyObject *v;	/* Temporary objects popped off stack */
+	register PyObject *w;
+	register PyObject *u;
+	register PyObject *t;
+	register PyObject *stream = NULL;    /* for PRINT opcodes */
+	register PyObject **fastlocals, **freevars;
+	PyThreadState *tstate = PyThreadState_GET();
+	PyCodeObject *co;
+
+	/* when tracing we set things up so that
+
+               not (instr_lb <= current_bytecode_offset < instr_ub)
+
+	   is true when the line being executed has changed.  The
+           initial values are such as to make this false the first
+           time it is tested. */
+	int instr_ub = -1, instr_lb = 0, instr_prev = -1;
+
+	unsigned char *first_instr;
+	PyObject *names;
+	PyObject *consts;
+#if defined(Py_DEBUG) || defined(LLTRACE)
+	/* Make it easier to find out where we are with a debugger */
+	char *filename;
+#endif
+
+#endif /* STACKLESS */
+
 	co = f->f_code;
 	names = co->co_names;
 	consts = co->co_consts;
@@ -764,6 +893,58 @@
 		goto on_error;
 	}
 
+
+#ifdef STACKLESS
+	if (f->f_execute == PyEval_EvalFrame_value) {
+        /* this is a return */
+		PUSH(retval); /* we are back from a function call */
+	}
+	else {
+		if (f->f_execute == PyEval_EvalFrame_iter) {
+			/* finalise the for_iter operation */
+			opcode = NEXTOP();
+			oparg = NEXTARG();
+			if (opcode == EXTENDED_ARG) {
+				opcode = NEXTOP();
+				oparg = oparg<<16 | NEXTARG();
+			}
+			assert(opcode == FOR_ITER);
+
+			if (retval != NULL) {
+				PUSH(retval);
+			}
+			else if (!PyErr_Occurred()) {
+				/* iterator ended normally */
+				retval = POP();
+				Py_DECREF(retval);
+				/* perform the delayed block jump */
+				JUMPBY(oparg);
+			}
+			else if (PyErr_ExceptionMatches(PyExc_StopIteration)) {
+				/* we need to check for stopiteration because
+				 * somebody might inject this as a real
+				 * exception.
+				 */
+				PyErr_Clear();
+				retval = POP();
+				Py_DECREF(retval);
+				JUMPBY(oparg);
+			}
+		}
+		else {
+			/* don't push it, frame ignores value */
+			Py_XDECREF(retval);
+		}
+		f->f_execute = PyEval_EvalFrame_value;
+	}
+
+	/* always check for an error flag */
+	if (retval == NULL) {
+		why = WHY_EXCEPTION;
+		goto on_error;
+	}
+#endif
+
 	for (;;) {
 #ifdef WITH_TSC
 		if (inst1 == 0) {
@@ -799,6 +980,29 @@
                                    a try: finally: block uninterruptable. */
                                 goto fast_next_opcode;
                         }
+#ifdef STACKLESS
+			if (tstate->st.interrupt &&
+			    !tstate->curexc_type) {
+				int ticks = _Py_CheckInterval - _Py_Ticker;
+				int mt = tstate->st.ticker -= ticks;
+				if (mt <= 0) {
+					PyObject *ires;
+					ires = tstate->st.interrupt();
+					if (ires == NULL) {
+						why = WHY_EXCEPTION;
+						goto on_error;
+
+					}
+					else if (STACKLESS_UNWINDING(ires)) {
+						goto stackless_interrupt_call;
+					}
+					/* hard switch, drop value */
+					Py_DECREF(ires);
+				}
+			}
+
+			/* standard ticker code */
+#endif
 			_Py_Ticker = _Py_CheckInterval;
 			tstate->tick_counter++;
 #ifdef WITH_TSC
@@ -2163,7 +2367,18 @@
 		case FOR_ITER:
 			/* before: [iter]; after: [iter, iter()] *or* [] */
 			v = TOP();
+#ifdef STACKLESS
+			{
+			    STACKLESS_PROPOSE_METHOD(v, tp_iternext);
+			    x = (*v->ob_type->tp_iternext)(v);
+			    STACKLESS_ASSERT();
+			}
+			if (STACKLESS_UNWINDING(x))
+				goto stackless_iter;
+stackless_iter_return:
+#else
 			x = (*v->ob_type->tp_iternext)(v);
+#endif
 			if (x != NULL) {
 				PUSH(x);
 				PREDICT(STORE_FAST);
@@ -2269,6 +2484,12 @@
 			x = call_function(&sp, oparg);
 #endif
 			stack_pointer = sp;
+#ifdef STACKLESS
+			if (STACKLESS_UNWINDING(x)) {
+				goto stackless_call;
+			}
+stackless_call_return:
+#endif
 			PUSH(x);
 			if (x != NULL)
 				continue;
@@ -2315,6 +2536,11 @@
 			    w = POP();
 			    Py_DECREF(w);
 		    }
+#ifdef STACKLESS
+		    if (STACKLESS_UNWINDING(x)) {
+			    goto stackless_call;
+		    }
+#endif
 		    PUSH(x);
 		    if (x != NULL)
 			    continue;
@@ -2595,11 +2821,64 @@
 	}
 
 	/* pop frame */
+#ifndef STACKLESS
     exit_eval_frame:
 	Py_LeaveRecursiveCall();
 	tstate->frame = f->f_back;
 
 	return retval;
+
+#else
+	Py_LeaveRecursiveCall();
+	tstate->frame = f->f_back;
+	Py_DECREF(f);
+	return retval;
+
+stackless_iter:
+	/* restore this opcode and enable frame to handle it */
+	f->f_execute = PyEval_EvalFrame_iter;
+	next_instr -= (oparg >> 16) ? 6 : 3;
+
+stackless_call:
+	retval = x;
+	/*
+	 * keep the reference to the frame to be called.
+	 */
+	f->f_stacktop = stack_pointer;
+
+	/* the -1 is to adjust for the f_lasti change.
+	   (look for the word 'Promise' above) */
+	f->f_lasti = INSTR_OFFSET() - 1;
+	if (tstate->frame->f_back != f)
+		return retval;
+	STACKLESS_UNPACK(retval);
+	retval = tstate->frame->f_execute(tstate->frame, throwflag, retval);
+	if (tstate->frame != f)
+		return retval;
+	if (STACKLESS_UNWINDING(retval))
+		STACKLESS_UNPACK(retval);
+
+	x = retval;
+	f->f_stacktop = NULL;
+	if (f->f_execute == PyEval_EvalFrame_iter) {
+		next_instr += (oparg >> 16) ? 6 : 3;
+		f->f_execute = PyEval_EvalFrame_value;
+			goto stackless_iter_return;
+	}
+
+	goto stackless_call_return;
+
+stackless_interrupt_call:
+
+	f->f_execute = PyEval_EvalFrame_noval;
+	f->f_stacktop = stack_pointer;
+
+	/* the -1 is to adjust for the f_lasti change.
+	   (look for the word 'Promise' above) */
+	f->f_lasti = INSTR_OFFSET() - 1;
+	f = tstate->frame;
+   	return (PyObject *) Py_UnwindToken;
+#endif
 }
 
 /* This is gonna seem *real weird*, but if you put some other code between
@@ -2611,6 +2890,7 @@
 	   PyObject **args, int argcount, PyObject **kws, int kwcount,
 	   PyObject **defs, int defcount, PyObject *closure)
 {
+	STACKLESS_GETARG();
 	register PyFrameObject *f;
 	register PyObject *retval = NULL;
 	register PyObject **fastlocals, **freevars;
@@ -2628,6 +2908,10 @@
 	if (f == NULL)
 		return NULL;
 
+#ifdef STACKLESS
+	f->f_execute = PyEval_EvalFrame_slp;
+#endif
+
 	fastlocals = f->f_localsplus;
 	freevars = f->f_localsplus + co->co_nlocals;
 
@@ -2829,7 +3113,26 @@
 		return PyGen_New(f);
 	}
 
+#ifdef STACKLESS
+	Py_INCREF(Py_None);
+	retval = Py_None;
+	if (stackless) {
+		tstate->frame = f;
+		return STACKLESS_PACK(retval);
+	}
+	else {
+		if (f->f_back != NULL)
+			/* use the faster path */
+			retval = slp_frame_dispatch(f, f->f_back, retval);
+        	else {
+			Py_DECREF(retval);
+			retval = slp_eval_frame(f);
+		}
+		return retval;
+	}
+#else
         retval = PyEval_EvalFrameEx(f,0);
+#endif
 
   fail: /* Jump here from prelude on failure */
 
@@ -3337,8 +3640,18 @@
 PyEval_GetGlobals(void)
 {
 	PyFrameObject *current_frame = PyEval_GetFrame();
+#ifdef STACKLESS
+	if (current_frame == NULL) {
+		PyThreadState *ts = PyThreadState_GET();
+
+		if (ts->st.current != NULL)
+			return ts->st.current->def_globals;
+		return NULL;
+	}
+#else
 	if (current_frame == NULL)
 		return NULL;
+#endif
 	else
 		return current_frame->f_globals;
 }
@@ -3409,6 +3722,7 @@
 PyObject *
 PyEval_CallObjectWithKeywords(PyObject *func, PyObject *arg, PyObject *kw)
 {
+	STACKLESS_GETARG();
 	PyObject *result;
 
 	if (arg == NULL) {
@@ -3431,7 +3745,9 @@
 		return NULL;
 	}
 
+	STACKLESS_PROMOTE_ALL();
 	result = PyObject_Call(func, arg, kw);
+	STACKLESS_ASSERT();
 	Py_DECREF(arg);
 	return result;
 }
@@ -3490,6 +3806,7 @@
 
 #define C_TRACE(x, call) \
 if (tstate->use_tracing && tstate->c_profilefunc) { \
+	STACKLESS_RETRACT(); \
 	if (call_trace(tstate->c_profilefunc, \
 		tstate->c_profileobj, \
 		tstate->frame, PyTrace_C_CALL, \
@@ -3545,6 +3862,7 @@
 		if (flags & (METH_NOARGS | METH_O)) {
 			PyCFunction meth = PyCFunction_GET_FUNCTION(func);
 			PyObject *self = PyCFunction_GET_SELF(func);
+			STACKLESS_PROPOSE_FLAG(flags & METH_STACKLESS);
 			if (flags & METH_NOARGS && na == 0) {
 				C_TRACE(x, (*meth)(self,NULL));
 			}
@@ -3554,6 +3872,7 @@
 				Py_DECREF(arg);
 			}
 			else {
+				STACKLESS_RETRACT();
 				err_args(func, flags, na);
 				x = NULL;
 			}
@@ -3562,10 +3881,12 @@
 			PyObject *callargs;
 			callargs = load_args(pp_stack, na);
 			READ_TIMESTAMP(*pintr0);
+			STACKLESS_PROPOSE_ALL();
 			C_TRACE(x, PyCFunction_Call(func,callargs,NULL));
 			READ_TIMESTAMP(*pintr1);
 			Py_XDECREF(callargs);
 		}
+		STACKLESS_ASSERT();
 	} else {
 		if (PyMethod_Check(func) && PyMethod_GET_SELF(func) != NULL) {
 			/* optimize access to bound methods */
@@ -3647,7 +3968,18 @@
 			Py_INCREF(*stack);
 			fastlocals[i] = *stack++;
 		}
+#ifdef STACKLESS
+		f->f_execute = PyEval_EvalFrame_slp;
+		if (slp_enable_softswitch) {
+			Py_INCREF(Py_None);
+			retval = Py_None;
+			tstate->frame = f;
+			return STACKLESS_PACK(retval);
+		}
+		return slp_eval_frame(f);
+#else
 		retval = PyEval_EvalFrameEx(f,0);
+#endif
 		assert(tstate != NULL);
 		++tstate->recursion_depth;
 		Py_DECREF(f);
@@ -3658,6 +3990,7 @@
 		d = &PyTuple_GET_ITEM(argdefs, 0);
 		nd = ((PyTupleObject *)argdefs)->ob_size;
 	}
+	STACKLESS_PROPOSE_ALL();
 	return PyEval_EvalCodeEx(co, globals,
 				 (PyObject *)NULL, (*pp_stack)-n, na,
 				 (*pp_stack)-2*nk, nk, d, nd,
@@ -3773,8 +4106,11 @@
 	else
 		PCALL(PCALL_OTHER);
 #endif
+	STACKLESS_PROPOSE(func);
 	result = PyObject_Call(func, callargs, kwdict);
- call_fail:
+	STACKLESS_ASSERT();
+
+call_fail:
 	Py_XDECREF(callargs);
 	Py_XDECREF(kwdict);
 	return result;
@@ -3842,8 +4178,11 @@
 	else
 		PCALL(PCALL_OTHER);
 #endif
+	STACKLESS_PROPOSE(func);
 	result = PyObject_Call(func, callargs, kwdict);
-      ext_call_fail:
+	STACKLESS_ASSERT();
+
+ext_call_fail:
 	Py_XDECREF(callargs);
 	Py_XDECREF(kwdict);
 	Py_XDECREF(stararg);

Modified: stackless/trunk/Python/getversion.c
==============================================================================
--- stackless/trunk/Python/getversion.c	(original)
+++ stackless/trunk/Python/getversion.c	Wed Jun 28 15:34:33 2006
@@ -5,6 +5,21 @@
 
 #include "patchlevel.h"
 
+#ifdef STACKLESS
+	/* avoiding to recompile everything for Stackless all the time */
+#include "stackless_version.h"
+
+const char *
+Py_GetVersion(void)
+{
+	static char version[250];
+	PyOS_snprintf(version, sizeof(version), "%.80s Stackless %.80s (%.80s) %.80s", 
+		      PY_VERSION, STACKLESS_VERSION, Py_GetBuildInfo(), Py_GetCompiler());
+	return version;
+}
+
+#else
+
 const char *
 Py_GetVersion(void)
 {
@@ -13,3 +28,5 @@
 		      PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler());
 	return version;
 }
+
+#endif

Modified: stackless/trunk/Python/pystate.c
==============================================================================
--- stackless/trunk/Python/pystate.c	(original)
+++ stackless/trunk/Python/pystate.c	Wed Jun 28 15:34:33 2006
@@ -2,6 +2,11 @@
 /* Thread and interpreter state structures and their interfaces */
 
 #include "Python.h"
+#ifdef STACKLESS
+/* XXX this should vanish! */
+#include "compile.h"
+#include "frameobject.h"
+#endif
 
 /* --------------------------------------------------------------------------
 CAUTION
@@ -145,7 +150,15 @@
 static struct _frame *
 threadstate_getframe(PyThreadState *self)
 {
+#ifdef STACKLESS
+	/* make sure to return a real frame */
+	struct _frame *f = self->frame;
+	while (f != NULL && !PyFrame_Check(f))
+		f = f->f_back;
+	return f;
+#else
 	return self->frame;
+#endif
 }
 
 PyThreadState *
@@ -186,6 +199,9 @@
 		tstate->c_tracefunc = NULL;
 		tstate->c_profileobj = NULL;
 		tstate->c_traceobj = NULL;
+#ifdef STACKLESS
+		STACKLESS_PYSTATE_NEW;
+#endif
 
 #ifdef WITH_THREAD
 		_PyGILState_NoteThreadState(tstate);
@@ -204,6 +220,9 @@
 void
 PyThreadState_Clear(PyThreadState *tstate)
 {
+#ifdef STACKLESS
+	STACKLESS_PYSTATE_CLEAR;
+#endif
 	if (Py_VerboseFlag && tstate->frame != NULL)
 		fprintf(stderr,
 		  "PyThreadState_Clear: warning: thread still has a frame\n");

Modified: stackless/trunk/Python/pythonrun.c
==============================================================================
--- stackless/trunk/Python/pythonrun.c	(original)
+++ stackless/trunk/Python/pythonrun.c	Wed Jun 28 15:34:33 2006
@@ -16,6 +16,7 @@
 #include "ast.h"
 #include "eval.h"
 #include "marshal.h"
+#include "core/stackless_impl.h"
 
 #ifdef HAVE_SIGNAL_H
 #include <signal.h>
@@ -180,6 +181,13 @@
 		Py_FatalError("Py_Initialize: can't make first thread");
 	(void) PyThreadState_Swap(tstate);
 
+#ifdef STACKLESS
+	if (!_PyStackless_InitTypes()) {
+		PyErr_Print();
+		Py_FatalError("Py_Initialize: can't init stackless types");
+	}
+#endif
+
 	_Py_ReadyTypes();
 
 	if (!_PyFrame_Init())
@@ -229,6 +237,9 @@
 	if (install_sigs)
 		initsigs(); /* Signal handling stuff, including initintr() */
 
+#ifdef STACKLESS
+	_PyStackless_Init();
+#endif
 	initmain(); /* Module __main__ */
 	if (!Py_NoSiteFlag)
 		initsite(); /* Module site */
@@ -349,6 +360,9 @@
 	 * the threads created via Threading.
 	 */
 	call_sys_exitfunc();
+#ifdef STACKLESS
+	PyStackless_kill_tasks_with_stacks(1);
+#endif
 	initialized = 0;
 
 	/* Get current thread state and interpreter pointer */
@@ -460,6 +474,9 @@
 	/* Cleanup Unicode implementation */
 	_PyUnicode_Fini();
 #endif
+#ifdef STACKLESS
+	PyStackless_Fini();
+#endif
 
 	/* XXX Still allocated:
 	   - various static ad-hoc pointers to interned strings
@@ -1032,6 +1049,13 @@
 	/* NOTREACHED */
 }
 
+#ifdef STACKLESS
+void PyStackless_HandleSystemExit()
+{
+	handle_system_exit();
+}
+#endif
+
 void
 PyErr_PrintEx(int set_sys_last_vars)
 {
@@ -1205,6 +1229,7 @@
 PyRun_FileExFlags(FILE *fp, const char *filename, int start, PyObject *globals,
 		  PyObject *locals, int closeit, PyCompilerFlags *flags)
 {
+	STACKLESS_GETARG();
 	PyObject *ret;
 	PyArena *arena = PyArena_New();
 	mod_ty mod = PyParser_ASTFromFile(fp, filename, start, 0, 0,
@@ -1215,6 +1240,7 @@
 	}
 	if (closeit)
 		fclose(fp);
+	STACKLESS_PROMOTE_ALL();
 	ret = run_mod(mod, filename, globals, locals, flags, arena);
 	PyArena_Free(arena);
 	return ret;
@@ -1224,12 +1250,15 @@
 run_mod(mod_ty mod, const char *filename, PyObject *globals, PyObject *locals,
 	 PyCompilerFlags *flags, PyArena *arena)
 {
+	STACKLESS_GETARG();
 	PyCodeObject *co;
 	PyObject *v;
 	co = PyAST_Compile(mod, filename, flags, arena);
 	if (co == NULL)
 		return NULL;
+	STACKLESS_PROMOTE_ALL();
 	v = PyEval_EvalCode(co, globals, locals);
+	STACKLESS_ASSERT();
 	Py_DECREF(co);
 	return v;
 }

Modified: stackless/trunk/Python/sysmodule.c
==============================================================================
--- stackless/trunk/Python/sysmodule.c	(original)
+++ stackless/trunk/Python/sysmodule.c	Wed Jun 28 15:34:33 2006
@@ -649,6 +649,10 @@
 
 	while (depth > 0 && f != NULL) {
 		f = f->f_back;
+#ifdef STACKLESS
+		if (f != NULL && !PyFrame_Check(f))
+			continue;
+#endif
 		--depth;
 	}
 	if (f == NULL) {
@@ -960,11 +964,15 @@
 	if (svn_initialized)
 		return;
 
+#ifdef STACKLESS
+	python = strstr(headurl, "/stackless/");
+#else
 	python = strstr(headurl, "/python/");
+#endif
 	if (!python)
 		Py_FatalError("subversion keywords missing");
 
-	br_start = python + 8;
+	br_start = python + 11;
 	br_end = strchr(br_start, '/');
 	/* Works even for trunk,
 	   as we are in trunk/Python/sysmodule.c */

Modified: stackless/trunk/Stackless/core/cframeobject.c
==============================================================================
--- stackless/trunk/Stackless/core/cframeobject.c	(original)
+++ stackless/trunk/Stackless/core/cframeobject.c	Wed Jun 28 15:34:33 2006
@@ -205,7 +205,7 @@
 };
 
 
-static PyObject * run_cframe(PyFrameObject *f, PyObject *retval)
+static PyObject * run_cframe(PyFrameObject *f, int exc, PyObject *retval)
 {
 	PyThreadState *ts = PyThreadState_GET();
 	PyCFrameObject *cf = (PyCFrameObject*) f;

Modified: stackless/trunk/Stackless/core/slp_exttype.h
==============================================================================
--- stackless/trunk/Stackless/core/slp_exttype.h	(original)
+++ stackless/trunk/Stackless/core/slp_exttype.h	Wed Jun 28 15:34:33 2006
@@ -46,6 +46,7 @@
 	signed char nb_floor_divide;
 	signed char nb_inplace_true_divide;
 	signed char nb_inplace_floor_divide;
+	signed char nb_index;
 	signed char sq_length;
 	signed char sq_concat;
 	signed char sq_repeat;

Modified: stackless/trunk/Stackless/core/stackless_impl.h
==============================================================================
--- stackless/trunk/Stackless/core/stackless_impl.h	(original)
+++ stackless/trunk/Stackless/core/stackless_impl.h	Wed Jun 28 15:34:33 2006
@@ -79,17 +79,17 @@
 
 /* the now exported eval_frame */
 PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *f);
-PyObject * PyEval_EvalFrame_slp(struct _frame *, PyObject *);
+PyObject * PyEval_EvalFrame_slp(struct _frame *, int, PyObject *);
 
 /* eval_frame with stack overflow, triggered there with a macro */
-PyAPI_FUNC(PyObject *) slp_eval_frame_newstack(struct _frame *f, PyObject *retval);
+PyAPI_FUNC(PyObject *) slp_eval_frame_newstack(struct _frame *f, int throwflag, PyObject *retval);
 
 /* the new eval_frame loop with or without value or resuming an iterator */
-PyAPI_FUNC(PyObject *) PyEval_EvalFrame_value(struct _frame *f,
+PyAPI_FUNC(PyObject *) PyEval_EvalFrame_value(struct _frame *f,  int throwflag,
 					      PyObject *retval);
-PyAPI_FUNC(PyObject *) PyEval_EvalFrame_noval(struct _frame *f,
+PyAPI_FUNC(PyObject *) PyEval_EvalFrame_noval(struct _frame *f,  int throwflag,
 					      PyObject *retval);
-PyAPI_FUNC(PyObject *) PyEval_EvalFrame_iter(struct _frame *f,
+PyAPI_FUNC(PyObject *) PyEval_EvalFrame_iter(struct _frame *f,  int throwflag,
 					     PyObject *retval);
 
 /* rebirth of software stack avoidance */
@@ -110,7 +110,7 @@
 
 PyAPI_DATA(PyTypeObject) PyGen_Type;
 PyAPI_FUNC(PyObject *) PyGenerator_New(struct _frame *f);
-PyAPI_FUNC(PyObject *) slp_gen_iternext(PyObject *gen);
+PyAPI_FUNC(PyObject *) slp_gen_send_ex(PyObject *gen, PyObject *arg, int exc);
 #define PyGenerator_Check(op) PyObject_TypeCheck(op, &PyGen_Type)
 
 PyAPI_DATA(PyTypeObject) PyMethodDescr_Type;

Modified: stackless/trunk/Stackless/core/stackless_methods.h
==============================================================================
--- stackless/trunk/Stackless/core/stackless_methods.h	(original)
+++ stackless/trunk/Stackless/core/stackless_methods.h	Wed Jun 28 15:34:33 2006
@@ -23,10 +23,10 @@
 	{&PyMethodWrapper_Type,		MFLAG_OFS(tp_call)},
 	/* from funcobject.c */
 	{&PyFunction_Type,		MFLAG_OFS(tp_call)},
+	/* from genobject.c */
+	{&PyGen_Type,			MFLAG_OFS(tp_iternext)},
 	/* from methodobject.c */
 	{&PyCFunction_Type,		MFLAG_OFS(tp_call)},
-	/* from ceval.c */
-	{&PyGen_Type,		MFLAG_OFS(tp_iternext)},
 	/* from channelobject.c */
 	{&PyChannel_TypePtr,		MFLAG_OFS_IND(tp_iternext)},
 	{0, 0} /* sentinel */

Modified: stackless/trunk/Stackless/core/stackless_tstate.h
==============================================================================
--- stackless/trunk/Stackless/core/stackless_tstate.h	(original)
+++ stackless/trunk/Stackless/core/stackless_tstate.h	Wed Jun 28 15:34:33 2006
@@ -64,9 +64,9 @@
 
 void slp_kill_tasks_with_stacks(struct _ts *tstate);
 
-#define __STACKLESS_PYSTATE_ZAP \
+#define __STACKLESS_PYSTATE_CLEAR \
 	slp_kill_tasks_with_stacks(tstate); \
-	ZAP(tstate->st.initial_stub);
+	Py_CLEAR(tstate->st.initial_stub);
 
 #ifdef WITH_THREAD
 
@@ -77,14 +77,14 @@
 	tstate->st.thread.is_locked = 0;
 
 
-#define STACKLESS_PYSTATE_ZAP \
-	__STACKLESS_PYSTATE_ZAP \
-	ZAP(tstate->st.thread.self_lock); \
-	ZAP(tstate->st.thread.unlock_lock);
+#define STACKLESS_PYSTATE_CLEAR \
+	__STACKLESS_PYSTATE_CLEAR \
+	Py_CLEAR(tstate->st.thread.self_lock); \
+	Py_CLEAR(tstate->st.thread.unlock_lock);
 
 #else
 
 #define STACKLESS_PYSTATE_NEW __STACKLESS_PYSTATE_NEW
-#define STACKLESS_PYSTATE_ZAP __STACKLESS_PYSTATE_ZAP
+#define STACKLESS_PYSTATE_CLEAR __STACKLESS_PYSTATE_CLEAR
 
 #endif

Modified: stackless/trunk/Stackless/core/stacklesseval.c
==============================================================================
--- stackless/trunk/Stackless/core/stacklesseval.c	(original)
+++ stackless/trunk/Stackless/core/stacklesseval.c	Wed Jun 28 15:34:33 2006
@@ -332,7 +332,7 @@
 /* cstack spilling for recursive calls */
 
 static PyObject *
-eval_frame_callback(PyFrameObject *f, PyObject *retval)
+eval_frame_callback(PyFrameObject *f, int exc, PyObject *retval)
 {
 	PyThreadState *ts = PyThreadState_GET();
 	PyTaskletObject *cur = ts->st.current;
@@ -343,7 +343,7 @@
 	ts->frame = f->f_back;
 	Py_DECREF(f);
 	cur->cstate = NULL;
-	retval = PyEval_EvalFrame_slp(ts->frame, retval);
+	retval = PyEval_EvalFrame_slp(ts->frame, exc, retval);
 	if (retval == NULL)
 		retval = slp_curexc_to_bomb();
 	if (retval == NULL)
@@ -358,7 +358,7 @@
 }
 
 PyObject *
-slp_eval_frame_newstack(PyFrameObject *f, PyObject *retval)
+slp_eval_frame_newstack(PyFrameObject *f, int exc, PyObject *retval)
 {
 	PyThreadState *ts = PyThreadState_GET();
 	PyTaskletObject *cur = ts->st.current;
@@ -368,7 +368,7 @@
 	if (ts->st.cstack_root == NULL) {
 		/* this is a toplevel call */
 		ts->st.cstack_root = STACK_REFPLUS + (intptr_t *) &f;
-		retval = PyEval_EvalFrame_slp(f, retval);
+		retval = PyEval_EvalFrame_slp(f, exc, retval);
 		return retval;
 	}
 
@@ -420,10 +420,10 @@
  * was not faster, but considerably slower than this solution.
  */
 
-static PyObject* gen_iternext_callback(PyFrameObject *f, PyObject *retval);
+static PyObject* gen_iternext_callback(PyFrameObject *f, int exc, PyObject *retval);
 
 PyObject *
-slp_gen_iternext(PyObject *ob)
+slp_gen_send_ex(PyGenObject *ob, PyObject *arg, int exc)
 {
 	STACKLESS_GETARG();
 	genobject *gen = (genobject *) ob;
@@ -437,8 +437,12 @@
 				"generator already executing");
 		return NULL;
 	}
-	if (f->f_stacktop == NULL)
+	if (f==NULL || f->f_stacktop == NULL) {
+		/* Only set exception if called from send() */
+		if (arg && !exc)
+			PyErr_SetNone(PyExc_StopIteration);
 		return NULL;
+	}
 
 	if (f->f_back == NULL &&
 		(f->f_back = (PyFrameObject *)
@@ -463,7 +467,10 @@
 	Py_INCREF(f->f_back);
 
 	Py_INCREF(gen);
+	Py_INCREF(arg);
 	((PyCFrameObject *) f->f_back)->ob1 = (PyObject *) gen;
+	((PyCFrameObject *) f->f_back)->ob2 = arg;
+	((PyCFrameObject *) f->f_back)->i = (long) exc;
 	Py_INCREF(f);
 	ts->frame = f;
 	if (stackless)
@@ -472,11 +479,14 @@
 }
 
 static PyObject*
-gen_iternext_callback(PyFrameObject *f, PyObject *retval)
+gen_iternext_callback(PyFrameObject *f, int exc, PyObject *result)
 {
 	PyThreadState *ts = PyThreadState_GET();
 	PyCFrameObject *cf = (PyCFrameObject *) f;
 	genobject *gen = (genobject *) cf->ob1;
+	PyObject *arg = cf->ob2;
+
+	exc = (int) cf->i;
 
 	gen->gi_running = 0;
 	/* make refcount compatible to frames for tasklet unpickling */
@@ -492,19 +502,24 @@
 	f = gen->gi_frame;
 	/* If the generator just returned (as opposed to yielding), signal
 	 * that the generator is exhausted. */
-	if (retval == Py_None && f->f_stacktop == NULL) {
-		Py_DECREF(retval);
-		retval = NULL;
+	if (result == Py_None && f->f_stacktop == NULL) {
+		Py_DECREF(result);
+		result = NULL;
+		if (arg)
+			PyErr_SetNone(PyExc_StopIteration);
+		/* Stackless extra handling */
 		/* are we awaited by a for_iter or called by next() ? */
-		if (ts->frame->f_execute != PyEval_EvalFrame_iter) {
+		else if (ts->frame->f_execute != PyEval_EvalFrame_iter) {
 			/* do the missing part of the next call */
 			if (!PyErr_Occurred())
 				PyErr_SetNone(PyExc_StopIteration);
 		}
 	}
 	cf->ob1 = NULL;
+	cf->ob2 = NULL;
 	Py_DECREF(gen);
-	return retval;
+	Py_DECREF(arg);
+	return result;
 }
 
 
@@ -578,7 +593,7 @@
 
 	while (1) {
 
-		retval = f->f_execute(f, retval);
+		retval = f->f_execute(f, 0, retval);
 		f = ts->frame;
 		if (STACKLESS_UNWINDING(retval))
 			STACKLESS_UNPACK(retval);
@@ -604,7 +619,7 @@
 
 	while (1) {
 
-		retval = f->f_execute(f, retval);
+		retval = f->f_execute(f, 0, retval);
 		f = ts->frame;
 		if (STACKLESS_UNWINDING(retval))
 			STACKLESS_UNPACK(retval);

Modified: stackless/trunk/Stackless/module/channelobject.c
==============================================================================
--- stackless/trunk/Stackless/module/channelobject.c	(original)
+++ stackless/trunk/Stackless/module/channelobject.c	Wed Jun 28 15:34:33 2006
@@ -746,7 +746,7 @@
  */
 
 static PyObject *
-channel_seq_callback(PyFrameObject *_f, PyObject *retval)
+channel_seq_callback(PyFrameObject *_f, int exc, PyObject *retval)
 {
 	PyThreadState *ts;
 	PyCFrameObject *f = (PyCFrameObject *) _f;

Modified: stackless/trunk/Stackless/module/scheduling.c
==============================================================================
--- stackless/trunk/Stackless/module/scheduling.c	(original)
+++ stackless/trunk/Stackless/module/scheduling.c	Wed Jun 28 15:34:33 2006
@@ -426,7 +426,7 @@
 /* non-recursive scheduling */
 
 static PyObject *
-restore_exception(PyFrameObject *f, PyObject *retval)
+restore_exception(PyFrameObject *f, int exc, PyObject *retval)
 {
 	PyThreadState *ts = PyThreadState_GET();
 	PyCFrameObject *cf = (PyCFrameObject *) f;
@@ -442,7 +442,7 @@
 }
 
 static PyObject *
-restore_tracing(PyFrameObject *f, PyObject *retval)
+restore_tracing(PyFrameObject *f, int exc, PyObject *retval)
 {
 	PyThreadState *ts = PyThreadState_GET();
 	PyCFrameObject *cf = (PyCFrameObject *) f;
@@ -463,7 +463,7 @@
 /* jumping from a soft tasklet to a hard switched */
 
 static PyObject *
-jump_soft_to_hard(PyFrameObject *f, PyObject *retval)
+jump_soft_to_hard(PyFrameObject *f, int exc, PyObject *retval)
 {
 	PyThreadState *ts = PyThreadState_GET();
 

Modified: stackless/trunk/Stackless/module/stacklessmodule.c
==============================================================================
--- stackless/trunk/Stackless/module/stacklessmodule.c	(original)
+++ stackless/trunk/Stackless/module/stacklessmodule.c	Wed Jun 28 15:34:33 2006
@@ -418,7 +418,7 @@
 
 static
 PyObject *
-test_cframe_nr_loop(PyFrameObject *f, PyObject *retval)
+test_cframe_nr_loop(PyFrameObject *f, int exc, PyObject *retval)
 {
 	PyThreadState *ts = PyThreadState_GET();
 	PyCFrameObject *cf = (PyCFrameObject *) f;

Modified: stackless/trunk/Stackless/module/taskletobject.c
==============================================================================
--- stackless/trunk/Stackless/module/taskletobject.c	(original)
+++ stackless/trunk/Stackless/module/taskletobject.c	Wed Jun 28 15:34:33 2006
@@ -729,7 +729,7 @@
 }
 
 static PyObject *
-post_schedule_remove(PyFrameObject *f, PyObject *retval)
+post_schedule_remove(PyFrameObject *f, int exc, PyObject *retval)
 {
 	PyThreadState *ts = PyThreadState_GET();
 	PyTaskletObject *parent = ts->st.current;

Modified: stackless/trunk/Stackless/pickling/prickelpit.c
==============================================================================
--- stackless/trunk/Stackless/pickling/prickelpit.c	(original)
+++ stackless/trunk/Stackless/pickling/prickelpit.c	Wed Jun 28 15:34:33 2006
@@ -316,9 +316,12 @@
 	proxyobject *dp = NULL;
 	int ret = -1;
 
+/*
+	WE CANNOT BE DOING THIS HERE, AS THE EXCEPTION CLASSES ARE NOT INITIALISED.
 	assert(PyObject_IsSubclass((PyObject *)t, (PyObject *)&PyFrame_Type) ||
 	       PyObject_IsSubclass((PyObject *)t,
 				   (PyObject *)&PyCFrame_Type));
+*/
 	if (0
 	    || PyType_Ready(t) || name == NULL
 	    || (nameobj = PyString_FromString(name)) == NULL
@@ -709,7 +712,8 @@
 
  ******************************************************/
 
-#define frametuplefmt "O)(OiSOiOOiOiiOO"
+#define frametuplefmt "O)(OiSOiOOOiiOO"
+/* #define frametuplefmt "O)(OiSOiOOiOiiOO" */
 
 DEF_INVALID_EXEC(eval_frame)
 DEF_INVALID_EXEC(eval_frame_value)
@@ -792,7 +796,7 @@
 			     have_locals,
 			     have_locals ? f->f_locals : dummy_locals,
 			     f->f_trace != NULL ? f->f_trace : Py_None,
-			     f->f_restricted,
+/*			     f->f_restricted, */
 			     exc_as_tuple,
 			     f->f_lasti,
 			     f->f_lineno,
@@ -810,7 +814,8 @@
 }
 
 #define frametuplenewfmt "O!"
-#define frametuplesetstatefmt "O!iSO!iO!OiOiiO!O:frame_new"
+#define frametuplesetstatefmt "O!iSO!iO!OOiiO!O:frame_new"
+/*#define frametuplesetstatefmt "O!iSO!iO!OiOiiO!O:frame_new"*/
 
 static PyObject *
 frame_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
@@ -843,7 +848,7 @@
 static PyObject *
 frame_setstate(PyFrameObject *f, PyObject *args)
 {
-	int f_restricted, f_lasti, f_lineno, i;
+	int /*f_restricted, */ f_lasti, f_lineno, i;
 	PyObject *f_globals, *f_locals, *blockstack_as_tuple;
         PyObject *localsplus_as_tuple, *exc_as_tuple, *trace, *f_code;
 	PyObject *exec_name = NULL;
@@ -869,7 +874,7 @@
 			       &have_locals,
 			       &PyDict_Type, &f_locals,
 			       &trace,
-			       &f_restricted,
+/*			       &f_restricted, */
 			       &exc_as_tuple,
 			       &f_lasti,
 			       &f_lineno,
@@ -904,7 +909,7 @@
 		f->f_trace = trace;
 	}
 
-	f->f_restricted = f_restricted;
+/*	f->f_restricted = f_restricted; */
 
 	if (exc_as_tuple != Py_None) {
 		if (PyTuple_GET_SIZE(exc_as_tuple) != 4) {
@@ -916,7 +921,7 @@
 	}
 
 	if (PyTuple_Check(localsplus_as_tuple)) {
-		int space =  f->f_stacksize + (f->f_valuestack - f->f_localsplus);
+		int space =  f->f_code->co_stacksize + (f->f_valuestack - f->f_localsplus);
 
 		if (PyTuple_GET_SIZE(localsplus_as_tuple)-1 > space) {
 			PyErr_SetString(PyExc_ValueError, "invalid localsplus for frame");

Modified: stackless/trunk/Stackless/pickling/prickelpit.h
==============================================================================
--- stackless/trunk/Stackless/pickling/prickelpit.h	(original)
+++ stackless/trunk/Stackless/pickling/prickelpit.h	Wed Jun 28 15:34:33 2006
@@ -27,7 +27,7 @@
 
 #define DEF_INVALID_EXEC(procname) \
 static PyObject *\
-cannot_##procname(PyFrameObject *f, PyObject *retval) \
+cannot_##procname(PyFrameObject *f, int exc, PyObject *retval) \
 { \
 	return slp_cannot_execute(f, #procname, retval); \
 }

Modified: stackless/trunk/Stackless/pickling/safe_pickle.c
==============================================================================
--- stackless/trunk/Stackless/pickling/safe_pickle.c	(original)
+++ stackless/trunk/Stackless/pickling/safe_pickle.c	Wed Jun 28 15:34:33 2006
@@ -11,7 +11,7 @@
 static int(*cPickle_save)(PyObject *, PyObject *, int) = NULL;
 
 static PyObject *
-pickle_callback(PyFrameObject *f, PyObject *retval)
+pickle_callback(PyFrameObject *f, int exc, PyObject *retval)
 {
 	PyThreadState *ts = PyThreadState_GET();
 	PyTaskletObject *cur = ts->st.current;
@@ -78,7 +78,7 @@
 static int _pers_save;
 
 static PyObject *
-pickle_runmain(PyFrameObject *f, PyObject *retval)
+pickle_runmain(PyFrameObject *f, int exc, PyObject *retval)
 {
 	PyThreadState *ts = PyThreadState_GET();
 	Py_XDECREF(retval);

Modified: stackless/trunk/configure
==============================================================================
--- stackless/trunk/configure	(original)
+++ stackless/trunk/configure	Wed Jun 28 15:34:33 2006
@@ -984,7 +984,7 @@
     else
       echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
     fi
-    cd $ac_popdir
+    cd "$ac_popdir"
   done
 fi
 
@@ -1540,6 +1540,17 @@
 	esac
 fi
 
+# Stackless flags for compiling the hard switching code
+case $MACHDEP in
+	darwin)
+		SLPFLAGS="-fomit-frame-pointer -O2"
+		;;
+	*)
+		SLPFLAGS="-fno-omit-frame-pointer -O2"
+		;;
+esac
+
+
 # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
 # disable features if it is defined, without any means to access these
 # features as extensions. For these systems, we skip the definition of
@@ -2562,8 +2573,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2653,8 +2663,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4378,8 +4387,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4549,8 +4557,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -5799,8 +5806,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -5881,8 +5887,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -5947,8 +5952,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6013,8 +6017,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6086,8 +6089,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6148,8 +6150,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6252,8 +6253,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6319,8 +6319,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6382,8 +6381,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6423,8 +6421,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6618,10 +6615,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -6733,8 +6728,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6796,8 +6790,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6837,8 +6830,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7032,10 +7024,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -7147,8 +7137,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7210,8 +7199,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7251,8 +7239,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7446,10 +7433,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -7561,8 +7546,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7624,8 +7608,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7665,8 +7648,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7860,10 +7842,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -7975,8 +7955,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8038,8 +8017,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8079,8 +8057,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8274,10 +8251,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -8389,8 +8364,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8452,8 +8426,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8493,8 +8466,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8688,10 +8660,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -8803,8 +8773,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8866,8 +8835,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8907,8 +8875,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9102,10 +9069,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -9217,8 +9182,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9280,8 +9244,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9321,8 +9284,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9378,8 +9340,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9516,10 +9477,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -9627,8 +9586,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9689,8 +9647,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9752,8 +9709,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9793,8 +9749,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9850,8 +9805,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9988,10 +9942,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -10225,8 +10177,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -10429,8 +10380,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -10716,8 +10666,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11229,8 +11178,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11434,8 +11382,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11510,8 +11457,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11713,8 +11659,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11784,8 +11729,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12054,8 +11998,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12209,8 +12152,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12390,8 +12332,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12483,8 +12424,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12547,8 +12487,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12697,8 +12636,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12855,8 +12793,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12929,8 +12866,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13256,8 +13192,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13459,8 +13394,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13608,8 +13542,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13999,8 +13932,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14243,8 +14175,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14305,8 +14236,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14360,8 +14290,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14415,8 +14344,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14470,8 +14398,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14525,8 +14452,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14580,8 +14506,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14645,8 +14570,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14704,8 +14628,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14763,8 +14686,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14873,8 +14795,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15018,8 +14939,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15082,8 +15002,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15145,8 +15064,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15271,8 +15189,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15372,8 +15289,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15441,8 +15357,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15511,8 +15426,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15620,8 +15534,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15689,8 +15602,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15759,8 +15671,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15875,8 +15786,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16094,8 +16004,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16147,8 +16056,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16245,8 +16153,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16298,8 +16205,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16396,8 +16302,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16449,8 +16354,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16516,8 +16420,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16585,8 +16488,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16823,8 +16725,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16891,8 +16792,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16954,8 +16854,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17020,8 +16919,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17142,8 +17040,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17207,8 +17104,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17251,8 +17147,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17317,8 +17212,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17361,8 +17255,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17427,8 +17320,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17537,8 +17429,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17581,8 +17472,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17647,8 +17537,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17691,8 +17580,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17757,8 +17645,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17801,8 +17688,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17880,8 +17766,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18004,8 +17889,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18068,8 +17952,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18241,8 +18124,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18357,8 +18239,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18540,8 +18421,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18599,8 +18479,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18661,8 +18540,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18761,8 +18639,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18830,8 +18707,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19991,10 +19867,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -20108,8 +19982,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -20320,8 +20193,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -20363,8 +20235,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -20421,8 +20292,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -20613,8 +20483,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -20690,8 +20559,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -22201,7 +22069,7 @@
 done
 
 
-SRCDIRS="Parser Grammar Objects Python Modules Mac"
+SRCDIRS="Parser Grammar Objects Python Modules Mac Mac/Python Stackless Stackless/core Stackless/module Stackless/pickling"
 echo "$as_me:$LINENO: checking for build directories" >&5
 echo $ECHO_N "checking for build directories... $ECHO_C" >&6
 for dir in $SRCDIRS; do
@@ -22212,6 +22080,14 @@
 echo "$as_me:$LINENO: result: done" >&5
 echo "${ECHO_T}done" >&6
 
+
+SLPFLAGS="-fno-omit-frame-pointer -O2"
+case $MACHDEP in
+darwin) SLPFLAGS="-fomit-frame-pointer -O2";;
+'') SLPFLAGS="-fno-omit-frame-pointer -O2";;
+esac
+
+
 # generate output files
                     ac_config_files="$ac_config_files Makefile.pre Modules/Setup.config"
 
@@ -22844,6 +22720,7 @@
 s, at FRAMEWORKALTINSTALLLAST@,$FRAMEWORKALTINSTALLLAST,;t t
 s, at FRAMEWORKUNIXTOOLSPREFIX@,$FRAMEWORKUNIXTOOLSPREFIX,;t t
 s, at MACHDEP@,$MACHDEP,;t t
+s, at SLPFLAGS@,$SLPFLAGS,;t t
 s, at SGI_ABI@,$SGI_ABI,;t t
 s, at EXTRAPLATDIR@,$EXTRAPLATDIR,;t t
 s, at EXTRAMACHDEPPATH@,$EXTRAMACHDEPPATH,;t t
@@ -23075,11 +22952,6 @@
   *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
   esac
 
-  if test x"$ac_file" != x-; then
-    { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-    rm -f "$ac_file"
-  fi
   # Let's still pretend it is `configure' which instantiates (i.e., don't
   # use $as_me), people would be surprised to read:
   #    /* config.h.  Generated by config.status.  */
@@ -23118,6 +22990,12 @@
 	 fi;;
       esac
     done` || { (exit 1); exit 1; }
+
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
   sed "$ac_vpsub

Modified: stackless/trunk/configure.in
==============================================================================
--- stackless/trunk/configure.in	(original)
+++ stackless/trunk/configure.in	Wed Jun 28 15:34:33 2006
@@ -187,6 +187,17 @@
 	esac
 fi
 	
+# Stackless flags for compiling the hard switching code
+case $MACHDEP in
+	darwin)
+		SLPFLAGS="-fomit-frame-pointer -O2"
+		;;
+	*)
+		SLPFLAGS="-fno-omit-frame-pointer -O2"
+		;;
+esac
+AC_SUBST(SLPFLAGS)
+
 # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
 # disable features if it is defined, without any means to access these
 # features as extensions. For these systems, we skip the definition of
@@ -3378,7 +3389,7 @@
 done
 
 AC_SUBST(SRCDIRS)
-SRCDIRS="Parser Grammar Objects Python Modules Mac"
+SRCDIRS="Parser Grammar Objects Python Modules Mac Stackless Stackless/core Stackless/module Stackless/pickling"
 AC_MSG_CHECKING(for build directories)
 for dir in $SRCDIRS; do
     if test ! -d $dir; then
@@ -3387,6 +3398,14 @@
 done
 AC_MSG_RESULT(done)
 
+AC_SUBST(SLPFLAGS)
+SLPFLAGS="-fno-omit-frame-pointer -O2"
+case $MACHDEP in
+darwin) SLPFLAGS="-fomit-frame-pointer -O2";;
+'') SLPFLAGS="-fno-omit-frame-pointer -O2";;
+esac
+
+
 # generate output files
 AC_CONFIG_FILES(Makefile.pre Modules/Setup.config)
 AC_OUTPUT

Modified: stackless/trunk/setup.py
==============================================================================
--- stackless/trunk/setup.py	(original)
+++ stackless/trunk/setup.py	Wed Jun 28 15:34:33 2006
@@ -115,7 +115,7 @@
         moddir = os.path.normpath(moddir)
 
         moddirlist = [moddir]
-        incdirlist = ['./Include']
+        incdirlist = ['./Include', './Stackless']
 
         # Platform-dependent module source and include directories
         platform = self.get_platform()
@@ -430,7 +430,7 @@
 
         # cStringIO and cPickle
         exts.append( Extension('cStringIO', ['cStringIO.c']) )
-        exts.append( Extension('cPickle', ['cPickle.c']) )
+        exts.append( Extension('cPickle', ['cPickle.c', '../Stackless/pickling/safe_pickle.c']) )
 
         # Memory-mapped files (also works on Win32).
         if platform not in ['atheos', 'mac']:

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



More information about the Stackless-checkins mailing list