--- //depot/sdk/Python23/Stackless/stackless_structs.h 2005/12/21 14:52:21 +++ //depot/sdk/Python23/Stackless/stackless_structs.h 2007/03/27 11:49:13 @@ -6,6 +6,9 @@ #endif +/* platform specific constants (mainly SEH stuff to store )*/ +#include "slp_platformselect.h" + /*** important structures: tasklet ***/ @@ -105,6 +108,9 @@ struct _tasklet *task; int nesting_level; PyThreadState *tstate; +#ifdef _SEH32 + DWORD exception_list; /* SEH handler on Win32 */ +#endif intptr_t *startaddr; intptr_t stack[1]; } PyCStackObject; --- //depot/sdk/Python23/Stackless/stacklesseval.c 2005/12/21 14:52:21 +++ //depot/sdk/Python23/Stackless/stacklesseval.c 2007/03/27 11:49:13 @@ -122,6 +122,11 @@ (*cst)->task = task; (*cst)->tstate = ts; (*cst)->nesting_level = ts->st.nesting_level; +#ifdef _SEH32 + //save the SEH handler + (*cst)->exception_list = (DWORD) + __readfsdword(FIELD_OFFSET(NT_TIB, ExceptionList)); +#endif return *cst; } @@ -130,6 +135,11 @@ { size_t stsizeb = (cstprev)->ob_size * sizeof(intptr_t); memcpy((cstprev)->stack, (cstprev)->startaddr - (cstprev)->ob_size, stsizeb); +#ifdef _SEH32 + //save the SEH handler + cstprev->exception_list = (DWORD) + __readfsdword(FIELD_OFFSET(NT_TIB, ExceptionList)); +#endif return stsizeb; } @@ -139,6 +149,10 @@ /* mark task as no longer responsible for cstack instance */ cst->task = NULL; memcpy(cst->startaddr - cst->ob_size, &cst->stack, (cst->ob_size) * sizeof(intptr_t)); +#ifdef _SEH32 + //restore the SEH handler + __writefsdword(FIELD_OFFSET(NT_TIB, ExceptionList), (DWORD)(cst->exception_list)); +#endif } --- //depot/sdk/Python23/Stackless/switch_x86_msvc.h 2005/04/25 20:31:12 +++ //depot/sdk/Python23/Stackless/switch_x86_msvc.h 2007/03/27 11:49:13 @@ -22,6 +22,16 @@ * Initial final version after lots of iterations for i386. */ +/* for the SEH things */ +#ifndef _WINDOWS_ +#define WIN32_LEAN_AND_MEAN +#ifdef BYTE +#undef BYTE +#endif +#include +#endif +#define _SEH32 + #define alloca _alloca #define STACK_REFPLUS 1