[Stackless-checkins] CVS: slpdev/src/2.2/src/Python bltinmodule.c, 1.2, 1.3 ceval.c, 1.64, 1.65 exceptions.c, 1.4, 1.5 modsupport.c, 1.1.1.2, 1.2 pythonrun.c, 1.11, 1.12

Christian Tismer tismer at centera.de
Sat May 1 22:31:02 CEST 2004


Update of /home/cvs/slpdev/src/2.2/src/Python
In directory centera.de:/tmp/cvs-serv27774/src/Python

Modified Files:
	bltinmodule.c ceval.c exceptions.c modsupport.c pythonrun.c 
Log Message:
first almost working backport!
It fails to import site, but a little generator works.
Now the debugging begins. :-)

Index: bltinmodule.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.2/src/Python/bltinmodule.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** bltinmodule.c	1 May 2004 01:21:10 -0000	1.2
--- bltinmodule.c	1 May 2004 20:31:00 -0000	1.3
***************
*** 458,467 ****
  builtin_eval(PyObject *self, PyObject *args)
  {
- <<<<<<< ../../2.2/src/./Python/bltinmodule.c
- 	PyObject *cmd;
- =======
  	STACKLESS_GETARG();
! 	PyObject *cmd, *result, *tmp = NULL;
! >>>>>>> ././Python/bltinmodule.c
  	PyObject *globals = Py_None, *locals = Py_None;
  	char *str;
--- 458,463 ----
  builtin_eval(PyObject *self, PyObject *args)
  {
  	STACKLESS_GETARG();
! 	PyObject *cmd, *result;
  	PyObject *globals = Py_None, *locals = Py_None;
  	char *str;
***************
*** 510,522 ****
  	cf.cf_flags = 0;
  	(void)PyEval_MergeCompilerFlags(&cf);
- <<<<<<< ../../2.2/src/./Python/bltinmodule.c
- 	return PyRun_StringFlags(str, Py_eval_input, globals, locals, &cf);
- =======
  	STACKLESS_PROMOTE_ALL();
  	result = PyRun_StringFlags(str, Py_eval_input, globals, locals, &cf);
  	STACKLESS_ASSERT();
- 	Py_XDECREF(tmp);
  	return result;
- >>>>>>> ././Python/bltinmodule.c
  }
  
--- 506,513 ----
***************
*** 1884,1895 ****
  	SETBUILTIN("unicode",		&PyUnicode_Type);
  #endif
- <<<<<<< ../../2.2/src/./Python/bltinmodule.c
  	debug = PyInt_FromLong(Py_OptimizeFlag == 0);
- =======
- #ifdef STACKLESS
- 	SETBUILTIN("generator",		&PyGenerator_Type);
- #endif
- 	debug = PyBool_FromLong(Py_OptimizeFlag == 0);
- >>>>>>> ././Python/bltinmodule.c
  	if (PyDict_SetItemString(dict, "__debug__", debug) < 0) {
  		Py_XDECREF(debug);
--- 1875,1879 ----

Index: ceval.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.2/src/Python/ceval.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -d -r1.64 -r1.65
*** ceval.c	1 May 2004 01:21:10 -0000	1.64
--- ceval.c	1 May 2004 20:31:00 -0000	1.65
***************
*** 38,46 ****
  #else
  static PyObject *eval_frame(PyFrameObject *);
- <<<<<<< ../../2.2/src/./Python/ceval.c
- =======
  #endif
  static PyObject *call_function(PyObject ***, int);
- >>>>>>> ././Python/ceval.c
  static PyObject *fast_function(PyObject *, PyObject ***, int, int, int);
  static PyObject *fast_cfunction(PyObject *, PyObject ***, int);
--- 38,43 ----
***************
*** 95,166 ****
  #endif
  
- <<<<<<< ../../2.2/src/./Python/ceval.c
- staticforward PyTypeObject gentype;
- =======
- /* Function call profile */
- #ifdef CALL_PROFILE
- #define PCALL_NUM 11
- static int pcall[PCALL_NUM];
- 
- #define PCALL_ALL 0
- #define PCALL_FUNCTION 1
- #define PCALL_FAST_FUNCTION 2
- #define PCALL_FASTER_FUNCTION 3
- #define PCALL_METHOD 4
- #define PCALL_BOUND_METHOD 5
- #define PCALL_CFUNCTION 6
- #define PCALL_TYPE 7
- #define PCALL_GENERATOR 8
- #define PCALL_OTHER 9
- #define PCALL_POP 10
- 
- /* Notes about the statistics
- 
-    PCALL_FAST stats
- 
-    FAST_FUNCTION means no argument tuple needs to be created.
-    FASTER_FUNCTION means that the fast-path frame setup code is used.
- 
-    If there is a method call where the call can be optimized by changing
-    the argument tuple and calling the function directly, it gets recorded
-    twice.
- 
-    As a result, the relationship among the statistics appears to be
-    PCALL_ALL == PCALL_FUNCTION + PCALL_METHOD - PCALL_BOUND_METHOD +
-                 PCALL_CFUNCTION + PCALL_TYPE + PCALL_GENERATOR + PCALL_OTHER
-    PCALL_FUNCTION > PCALL_FAST_FUNCTION > PCALL_FASTER_FUNCTION
-    PCALL_METHOD > PCALL_BOUND_METHOD
- */
- 
- #define PCALL(POS) pcall[POS]++
- 
- PyObject *
- PyEval_GetCallStats(PyObject *self)
- {
- 	return Py_BuildValue("iiiiiiiiii", 
- 			     pcall[0], pcall[1], pcall[2], pcall[3],
- 			     pcall[4], pcall[5], pcall[6], pcall[7],
- 			     pcall[8], pcall[9]);
- }
- #else
- #define PCALL(O)
- 
- PyObject *
- PyEval_GetCallStats(PyObject *self)
- {
- 	Py_INCREF(Py_None);
- 	return Py_None;
- }
- #endif
- 
  #ifdef STACKLESS
! 
! /* the whole generator implementation is moved to stacklesseval.c */
! #define gen_new(arg) PyGenerator_New((arg))
! 
  #else
! 
! static PyTypeObject gentype;
! >>>>>>> ././Python/ceval.c
  
  typedef struct {
--- 92,101 ----
  #endif
  
  #ifdef STACKLESS
! PyTypeObject PyGenerator_Type;
! #define gentype PyGenerator_Type
  #else
! staticforward PyTypeObject gentype;
! #endif
  
  typedef struct {
***************
*** 174,179 ****
--- 109,120 ----
  } genobject;
  
+ #ifdef STACKLESS
+ PyObject *
+ PyGenerator_New(PyFrameObject *f)
+ #define gen_new PyGenerator_New
+ #else
  static PyObject *
  gen_new(PyFrameObject *f)
+ #endif
  {
  	genobject *gen = PyObject_New(genobject, &gentype);
***************
*** 200,203 ****
--- 141,148 ----
  }
  
+ #ifdef STACKLESS
+ #define gen_iternext(arg) slp_gen_iternext((PyObject *)arg)
+ #else
+ 
  static PyObject *
  gen_iternext(genobject *gen)
***************
*** 241,244 ****
--- 186,191 ----
  }
  
+ #endif
+ 
  static PyObject *
  gen_next(genobject *gen)
***************
*** 275,279 ****
--- 222,230 ----
  };
  
+ #ifdef STACKLESS
+ PyTypeObject PyGenerator_Type = {
+ #else
  statichere PyTypeObject gentype = {
+ #endif
  	PyObject_HEAD_INIT(&PyType_Type)
  	0,					/* ob_size */
***************
*** 304,308 ****
--- 255,263 ----
  	0,					/* tp_weaklistoffset */
  	(getiterfunc)gen_getiter,		/* tp_iter */
+ #ifdef STACKLESS
+ 	(iternextfunc)slp_gen_iternext,		/* tp_iternext */
+ #else
  	(iternextfunc)gen_iternext,		/* tp_iternext */
+ #endif
  	gen_methods,				/* tp_methods */
  	gen_memberlist,				/* tp_members */
***************
*** 312,317 ****
  };
  
- #endif /* not STACKLESS */
- 
  #ifdef WITH_THREAD
  
--- 267,270 ----
***************
*** 607,623 ****
  #endif
  
- <<<<<<< ../../2.2/src/./Python/ceval.c
- =======
  #endif  /* not STACKLESS */
  
- /* Tuple access macros */
- 
- #ifndef Py_DEBUG
- #define GETITEM(v, i) PyTuple_GET_ITEM((PyTupleObject *)(v), (i))
- #else
- #define GETITEM(v, i) PyTuple_GetItem((v), (i))
- #endif
- 
- >>>>>>> ././Python/ceval.c
  /* Code access macros */
  
--- 560,565 ----
***************
*** 785,790 ****
  
  	unsigned char *first_instr;
- 	PyObject *names;
- 	PyObject *consts;
  #ifdef LLTRACE
  	int lltrace;
--- 727,730 ----
***************
*** 872,889 ****
  		   Py_MakePendingCalls() above. */
  
- <<<<<<< ../../2.2/src/./Python/ceval.c
  		if (things_to_do || --tstate->ticker < 0) {
- 			tstate->ticker = tstate->interp->checkinterval;
- =======
- 		if (--_Py_Ticker < 0) {
-                         if (*next_instr == SETUP_FINALLY) {
-                                 /* Make the last opcode before
-                                    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) {
--- 812,820 ----
  		   Py_MakePendingCalls() above. */
  
  		if (things_to_do || --tstate->ticker < 0) {
  #ifdef STACKLESS
  			if (tstate->st.interrupt &&
  			    !tstate->curexc_type) {
! 				int ticks = tstate->interp->checkinterval - tstate->ticker;
  				int mt = tstate->st.ticker -= ticks;
  				if (mt <= 0) {
***************
*** 905,910 ****
  			/* standard ticker code */
  #endif
! 			_Py_Ticker = _Py_CheckInterval;
! >>>>>>> ././Python/ceval.c
  			tstate->tick_counter++;
  			if (things_to_do) {
--- 836,840 ----
  			/* standard ticker code */
  #endif
! 			tstate->ticker = tstate->interp->checkinterval;
  			tstate->tick_counter++;
  			if (things_to_do) {
***************
*** 2222,2226 ****
  			continue;
  
- <<<<<<< ../../2.2/src/./Python/ceval.c
  		case SET_LINENO:
  #ifdef LLTRACE
--- 2152,2155 ----
***************
*** 2230,2245 ****
  			f->f_lineno = oparg;
  			if (tstate->c_tracefunc == NULL || tstate->tracing)
- =======
- 		case CALL_FUNCTION:
- 			PCALL(PCALL_ALL);
- 			x = call_function(&stack_pointer, oparg);
- #ifdef STACKLESS
- 			if (STACKLESS_UNWINDING(x)) {
- 				goto stackless_call;
- 			}
- #endif
- 			PUSH(x);
- 			if (x != NULL)
- >>>>>>> ././Python/ceval.c
  				continue;
  			/* Trace each line of code reached */
--- 2159,2162 ----
***************
*** 2315,2318 ****
--- 2232,2240 ----
  			    Py_DECREF(w);
  		    }
+ #ifdef STACKLESS
+ 		    if (STACKLESS_UNWINDING(x)) {
+ 			goto stackless_call;
+ 		    }
+ #endif
  		    PUSH(x);
  		    if (x != NULL)
***************
*** 2661,2665 ****
  	/* 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;
  
--- 2583,2587 ----
  	/* the -1 is to adjust for the f_lasti change.
  	   (look for the word 'Promise' above) */
! 	f->f_lasti = INSTR_OFFSET();
  	f = tstate->frame;
  
***************
*** 2688,2692 ****
  	/* 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;
--- 2610,2614 ----
  	/* the -1 is to adjust for the f_lasti change.
  	   (look for the word 'Promise' above) */
! 	f->f_lasti = INSTR_OFFSET();
  	f = tstate->frame;
     	return (PyObject *) Py_UnwindToken;
***************
*** 2928,2941 ****
  	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;
--- 2850,2863 ----
  	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;
***************
*** 3270,3428 ****
  }
  
- <<<<<<< ../../2.2/src/./Python/ceval.c
- =======
- PyObject *
- _PyEval_CallTracing(PyObject *func, PyObject *args)
- {
- #ifndef STACKLESS
- 	PyFrameObject *frame = PyEval_GetFrame();
- 	PyThreadState *tstate = frame->f_tstate;
- #else
- 	PyThreadState *tstate = PyThreadState_GET();
- #endif
- 	int save_tracing = tstate->tracing;
- 	int save_use_tracing = tstate->use_tracing;
- 	PyObject *result;
- 
- 	tstate->tracing = 0;
- 	tstate->use_tracing = ((tstate->c_tracefunc != NULL)
- 			       || (tstate->c_profilefunc != NULL));
- 	result = PyObject_Call(func, args, NULL);
- 	tstate->tracing = save_tracing;
- 	tstate->use_tracing = save_use_tracing;
- 	return result;
- }
- 
- static int
- maybe_call_line_trace(Py_tracefunc func, PyObject *obj, 
- 		      PyFrameObject *frame, int *instr_lb, int *instr_ub)
- {
- 	/* The theory of SET_LINENO-less tracing.
- 	   
- 	   In a nutshell, we use the co_lnotab field of the code object
- 	   to tell when execution has moved onto a different line.
- 
- 	   As mentioned above, the basic idea is so set things up so
- 	   that
- 
- 	         *instr_lb <= frame->f_lasti < *instr_ub
- 
- 	   is true so long as execution does not change lines.
- 
- 	   This is all fairly simple.  Digging the information out of
- 	   co_lnotab takes some work, but is conceptually clear.
- 
- 	   Somewhat harder to explain is why we don't *always* call the
- 	   line trace function when the above test fails.
- 
- 	   Consider this code:
- 
- 	   1: def f(a):
- 	   2:     if a:
- 	   3:        print 1
- 	   4:     else:
- 	   5:        print 2
- 
- 	   which compiles to this:
- 
- 	   2           0 LOAD_FAST                0 (a)
- 		       3 JUMP_IF_FALSE            9 (to 15)
- 		       6 POP_TOP             
- 
- 	   3           7 LOAD_CONST               1 (1)
- 		      10 PRINT_ITEM          
- 		      11 PRINT_NEWLINE       
- 		      12 JUMP_FORWARD             6 (to 21)
- 		 >>   15 POP_TOP             
- 
- 	   5          16 LOAD_CONST               2 (2)
- 		      19 PRINT_ITEM          
- 		      20 PRINT_NEWLINE       
- 		 >>   21 LOAD_CONST               0 (None)
- 		      24 RETURN_VALUE
- 
- 	   If 'a' is false, execution will jump to instruction at offset
- 	   15 and the co_lnotab will claim that execution has moved to
- 	   line 3.  This is at best misleading.  In this case we could
- 	   associate the POP_TOP with line 4, but that doesn't make
- 	   sense in all cases (I think).
- 
- 	   What we do is only call the line trace function if the co_lnotab
- 	   indicates we have jumped to the *start* of a line, i.e. if the
- 	   current instruction offset matches the offset given for the
- 	   start of a line by the co_lnotab.
- 
- 	   This also takes care of the situation where 'a' is true.
- 	   Execution will jump from instruction offset 12 to offset 21.
- 	   Then the co_lnotab would imply that execution has moved to line
- 	   5, which is again misleading.
- 
- 	   Why do we set f_lineno when tracing?  Well, consider the code
- 	   above when 'a' is true.  If stepping through this with 'n' in
- 	   pdb, you would stop at line 1 with a "call" type event, then
- 	   line events on lines 2 and 3, then a "return" type event -- but
- 	   you would be shown line 5 during this event.  This is a change
- 	   from the behaviour in 2.2 and before, and I've found it
- 	   confusing in practice.  By setting and using f_lineno when
- 	   tracing, one can report a line number different from that
- 	   suggested by f_lasti on this one occasion where it's desirable.
- 	*/
- 
- 	int result = 0;
- 
- 	if ((frame->f_lasti < *instr_lb || frame->f_lasti >= *instr_ub)) {
- 		PyCodeObject* co = frame->f_code;
- 		int size, addr, line;
- 		unsigned char* p;
- 
- 		size = PyString_GET_SIZE(co->co_lnotab) / 2;
- 		p = (unsigned char*)PyString_AS_STRING(co->co_lnotab);
- 
- 		addr = 0;
- 		line = co->co_firstlineno;
- 
- 		/* possible optimization: if f->f_lasti == instr_ub
- 		   (likely to be a common case) then we already know
- 		   instr_lb -- if we stored the matching value of p
- 		   somwhere we could skip the first while loop. */
- 
- 		/* see comments in compile.c for the description of
- 		   co_lnotab.  A point to remember: increments to p
- 		   should come in pairs -- although we don't care about
- 		   the line increments here, treating them as byte
- 		   increments gets confusing, to say the least. */
- 
- 		while (size > 0) {
- 			if (addr + *p > frame->f_lasti)
- 				break;
- 			addr += *p++;
- 			if (*p) *instr_lb = addr;
- 			line += *p++;
- 			--size;
- 		}
- 
- 		if (addr == frame->f_lasti) {
- 			frame->f_lineno = line;
- 			result = call_trace(func, obj, frame, 
- 					    PyTrace_LINE, Py_None);
- 		}
- 
- 		if (size > 0) {
- 			while (--size >= 0) {
- 				addr += *p++;
- 				if (*p++)
- 					break;
- 			}
- 			*instr_ub = addr;
- 		}
- 		else {
- 			*instr_ub = INT_MAX;
- 		}
- 	}
- 
- 	return result;
- }
- 
- >>>>>>> ././Python/ceval.c
  void
  PyEval_SetProfile(Py_tracefunc func, PyObject *arg)
--- 3192,3195 ----
***************
*** 3618,3636 ****
  */
  
  static PyObject *
  fast_cfunction(PyObject *func, PyObject ***pp_stack, int na)
  {
- <<<<<<< ../../2.2/src/./Python/ceval.c
  	PyCFunction meth = PyCFunction_GET_FUNCTION(func);
  	PyObject *self = PyCFunction_GET_SELF(func);
  	int flags = PyCFunction_GET_FLAGS(func);
  
  	switch (flags) {
  	case METH_OLDARGS:
  		if (na == 0)
! 			return (*meth)(self, NULL);
  		else if (na == 1) {
  			PyObject *arg = EXT_POP(*pp_stack);
  			PyObject *result =  (*meth)(self, arg);
  			Py_DECREF(arg);
  			return result;
--- 3385,3419 ----
  */
  
+ #ifdef STACKLESS
+ #define WRAP_RETURN(call) { \
+ 	PyObject * retval; \
+ 	retval = (call); \
+ 	STACKLESS_ASSERT(); \
+ 	return retval; \
+ }
+ #else
+ #define WRAP_RETURN(call) return (call)
+ #endif
+ 
  static PyObject *
  fast_cfunction(PyObject *func, PyObject ***pp_stack, int na)
  {
  	PyCFunction meth = PyCFunction_GET_FUNCTION(func);
  	PyObject *self = PyCFunction_GET_SELF(func);
  	int flags = PyCFunction_GET_FLAGS(func);
  
+ #ifdef STACKLESS
+ 	switch (flags & ~METH_STACKLESS) {
+ #else
  	switch (flags) {
+ 		#endif
  	case METH_OLDARGS:
+ 		STACKLESS_PROPOSE_FLAG(flags & METH_STACKLESS);
  		if (na == 0)
! 			WRAP_RETURN( (*meth)(self, NULL) )
  		else if (na == 1) {
  			PyObject *arg = EXT_POP(*pp_stack);
  			PyObject *result =  (*meth)(self, arg);
+ 			STACKLESS_ASSERT();
  			Py_DECREF(arg);
  			return result;
***************
*** 3638,3647 ****
  			PyObject *args = load_args(pp_stack, na);
  			PyObject *result = (*meth)(self, args);
  			Py_DECREF(args);
  			return result;
  		}
  	case METH_NOARGS:
  		if (na == 0)
! 			return (*meth)(self, NULL);
  		PyErr_Format(PyExc_TypeError,
  			     "%.200s() takes no arguments (%d given)",
--- 3421,3433 ----
  			PyObject *args = load_args(pp_stack, na);
  			PyObject *result = (*meth)(self, args);
+ 			STACKLESS_ASSERT();
  			Py_DECREF(args);
  			return result;
  		}
  	case METH_NOARGS:
+ 		STACKLESS_PROPOSE_FLAG(flags & METH_STACKLESS);
  		if (na == 0)
! 			WRAP_RETURN( (*meth)(self, NULL) )
! 		STACKLESS_RETRACT();
  		PyErr_Format(PyExc_TypeError,
  			     "%.200s() takes no arguments (%d given)",
***************
*** 3651,3690 ****
  		if (na == 1) {
  			PyObject *arg = EXT_POP(*pp_stack);
! 			PyObject *result = (*meth)(self, arg);
! 			Py_DECREF(arg);
! 			return result;
! =======
! 	int na = oparg & 0xff;
! 	int nk = (oparg>>8) & 0xff;
! 	int n = na + 2 * nk;
! 	PyObject **pfunc = (*pp_stack) - n - 1;
! 	PyObject *func = *pfunc;
! 	PyObject *x, *w;
  
- 	/* Always dispatch PyCFunction first, because these are
- 	   presumed to be the most frequent callable object.
- 	*/
- 	if (PyCFunction_Check(func) && nk == 0) {
- 		int flags = PyCFunction_GET_FLAGS(func);
- 		PCALL(PCALL_CFUNCTION);
- 		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) 
! 				x = (*meth)(self, NULL);
! 			else if (flags & METH_O && na == 1) {
! 				PyObject *arg = EXT_POP(*pp_stack);
! 				x = (*meth)(self, arg);
! 				Py_DECREF(arg);
! 			}
! 			else {
! 				STACKLESS_RETRACT();
! 				err_args(func, flags, na);
! 				x = NULL;
! 			}
! >>>>>>> ././Python/ceval.c
  		}
- <<<<<<< ../../2.2/src/./Python/ceval.c
  		PyErr_Format(PyExc_TypeError,
  			     "%.200s() takes exactly one argument (%d given)",
--- 3437,3448 ----
  		if (na == 1) {
  			PyObject *arg = EXT_POP(*pp_stack);
! 			PyObject *result;
  
  			STACKLESS_PROPOSE_FLAG(flags & METH_STACKLESS);
! 			result = (*meth)(self, arg);
! 			STACKLESS_ASSERT();
! 			Py_DECREF(arg);
! 			return result;
  		}
  		PyErr_Format(PyExc_TypeError,
  			     "%.200s() takes exactly one argument (%d given)",
***************
*** 3697,3739 ****
  		return NULL;
  	}		
- =======
- 		else {
- 			PyObject *callargs;
- 			callargs = load_args(pp_stack, na);
- 			STACKLESS_PROPOSE_ALL();
- 			x = PyCFunction_Call(func, callargs, NULL);
- 			Py_XDECREF(callargs); 
- 		} 
- 		STACKLESS_ASSERT();
- 	} else {
- 		if (PyMethod_Check(func) && PyMethod_GET_SELF(func) != NULL) {
- 			/* optimize access to bound methods */
- 			PyObject *self = PyMethod_GET_SELF(func);
- 			PCALL(PCALL_METHOD);
- 			PCALL(PCALL_BOUND_METHOD);
- 			Py_INCREF(self);
- 			func = PyMethod_GET_FUNCTION(func);
- 			Py_INCREF(func);
- 			Py_DECREF(*pfunc);
- 			*pfunc = self;
- 			na++;
- 			n++;
- 		} else
- 			Py_INCREF(func);
- 		if (PyFunction_Check(func))
- 			x = fast_function(func, pp_stack, n, na, nk);
- 		else 
- 			x = do_call(func, pp_stack, na, nk);
- 		Py_DECREF(func);
- 	}
- 	
- 	/* What does this do? */
- 	while ((*pp_stack) > pfunc) {
- 		w = EXT_POP(*pp_stack);
- 		Py_DECREF(w);
- 		PCALL(PCALL_POP);
- 	}
- 	return x;
- >>>>>>> ././Python/ceval.c
  }
  
--- 3455,3458 ----
***************
*** 3748,3812 ****
  	int nd = 0;
  
- <<<<<<< ../../2.2/src/./Python/ceval.c
- =======
- 	PCALL(PCALL_FUNCTION);
- 	PCALL(PCALL_FAST_FUNCTION);
- 	if (argdefs == NULL && co->co_argcount == n && nk==0 &&
- 	    co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
- 		PyFrameObject *f;
- 		PyObject *retval = NULL;
- 		PyThreadState *tstate = PyThreadState_GET();
- 		PyObject **fastlocals, **stack;
- 		int i;
- 
- 		PCALL(PCALL_FASTER_FUNCTION);
- 		assert(globals != NULL);
- 		/* XXX Perhaps we should create a specialized
- 		   PyFrame_New() that doesn't take locals, but does
- 		   take builtins without sanity checking them.
- 		*/
- 		f = PyFrame_New(tstate, co, globals, NULL);
- 		if (f == NULL)
- 			return NULL;
- 
- 		fastlocals = f->f_localsplus;
- 		stack = (*pp_stack) - n;
- 
- 		for (i = 0; i < n; i++) {
- 			Py_INCREF(*stack);
- 			fastlocals[i] = *stack++;
- 		}
- #ifdef STACKLESS
- 		Py_INCREF(Py_None);
- 		retval = Py_None;
- 		f->f_execute = PyEval_EvalFrame;
- 		tstate->frame = f;
- 		return STACKLESS_PACK(retval);
- #else
- 		retval = eval_frame(f);
- #endif
- 		assert(tstate != NULL);
- 		++tstate->recursion_depth;
- 		Py_DECREF(f);
- 		--tstate->recursion_depth;
- 		return retval;
- 	}
- >>>>>>> ././Python/ceval.c
  	if (argdefs != NULL) {
  		d = &PyTuple_GET_ITEM(argdefs, 0);
  		nd = ((PyTupleObject *)argdefs)->ob_size;
  	}
- <<<<<<< ../../2.2/src/./Python/ceval.c
- 	return PyEval_EvalCodeEx((PyCodeObject *)co, globals,
- 			  (PyObject *)NULL, (*pp_stack)-n, na,
- 			  (*pp_stack)-2*nk, nk, d, nd,
- 			  closure);
- =======
  	STACKLESS_PROPOSE_ALL();
! 	return PyEval_EvalCodeEx(co, globals,
  				 (PyObject *)NULL, (*pp_stack)-n, na,
  				 (*pp_stack)-2*nk, nk, d, nd,
! 				 PyFunction_GET_CLOSURE(func));
! >>>>>>> ././Python/ceval.c
  }
  
--- 3467,3479 ----
  	int nd = 0;
  
  	if (argdefs != NULL) {
  		d = &PyTuple_GET_ITEM(argdefs, 0);
  		nd = ((PyTupleObject *)argdefs)->ob_size;
  	}
  	STACKLESS_PROPOSE_ALL();
! 	return PyEval_EvalCodeEx((PyCodeObject *)co, globals,
  				 (PyObject *)NULL, (*pp_stack)-n, na,
  				 (*pp_stack)-2*nk, nk, d, nd,
! 				 closure);
  }
  
***************
*** 3906,3927 ****
  	if (callargs == NULL)
  		goto call_fail;
- <<<<<<< ../../2.2/src/./Python/ceval.c
- =======
- #ifdef CALL_PROFILE
- 	/* At this point, we have to look at the type of func to
- 	   update the call stats properly.  Do it here so as to avoid
- 	   exposing the call stats machinery outside ceval.c
- 	*/
- 	if (PyFunction_Check(func))
- 		PCALL(PCALL_FUNCTION);
- 	else if (PyMethod_Check(func))
- 		PCALL(PCALL_METHOD);
- 	else if (PyType_Check(func))
- 		PCALL(PCALL_TYPE);
- 	else
- 		PCALL(PCALL_OTHER);
- #endif
  	STACKLESS_PROPOSE(func);
- >>>>>>> ././Python/ceval.c
  	result = PyObject_Call(func, callargs, kwdict);
  	STACKLESS_ASSERT();
--- 3573,3577 ----
***************
*** 3981,4002 ****
  	if (callargs == NULL)
  		goto ext_call_fail;
- <<<<<<< ../../2.2/src/./Python/ceval.c
- =======
- #ifdef CALL_PROFILE
- 	/* At this point, we have to look at the type of func to
- 	   update the call stats properly.  Do it here so as to avoid
- 	   exposing the call stats machinery outside ceval.c
- 	*/
- 	if (PyFunction_Check(func))
- 		PCALL(PCALL_FUNCTION);
- 	else if (PyMethod_Check(func))
- 		PCALL(PCALL_METHOD);
- 	else if (PyType_Check(func))
- 		PCALL(PCALL_TYPE);
- 	else
- 		PCALL(PCALL_OTHER);
- #endif
  	STACKLESS_PROPOSE(func);
- >>>>>>> ././Python/ceval.c
  	result = PyObject_Call(func, callargs, kwdict);
  	STACKLESS_ASSERT();
--- 3631,3635 ----

Index: exceptions.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.2/src/Python/exceptions.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** exceptions.c	1 May 2004 01:21:10 -0000	1.4
--- exceptions.c	1 May 2004 20:31:00 -0000	1.5
***************
*** 26,37 ****
   * compile-time literal concatenation.
   */
- <<<<<<< ../../2.2/src/./Python/exceptions.c
- static char
- module__doc__[] =
- =======
- 
- /* NOTE: If the exception class hierarchy changes, don't forget to update
-  * Doc/lib/libexcs.tex!
-  */
  
  #ifdef STACKLESS
--- 26,29 ----
***************
*** 44,49 ****
  #endif
  
! PyDoc_STRVAR(module__doc__,
! >>>>>>> ././Python/exceptions.c
  "Python's standard exception class hierarchy.\n\
  \n\
--- 36,41 ----
  #endif
  
! static char
! module__doc__[] =
  "Python's standard exception class hierarchy.\n\
  \n\

Index: modsupport.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.2/src/Python/modsupport.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -C2 -d -r1.1.1.2 -r1.2
*** modsupport.c	15 Oct 2002 22:27:07 -0000	1.1.1.2
--- modsupport.c	1 May 2004 20:31:00 -0000	1.2
***************
*** 57,60 ****
--- 57,63 ----
  		return NULL;
  	d = PyModule_GetDict(m);
+ #ifdef STACKLESS
+ 	if (methods != NULL)
+ #endif
  	for (ml = methods; ml->ml_name != NULL; ml++) {
  		v = PyCFunction_New(ml, passthrough);

Index: pythonrun.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.2/src/Python/pythonrun.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** pythonrun.c	1 May 2004 01:21:10 -0000	1.11
--- pythonrun.c	1 May 2004 20:31:00 -0000	1.12
***************
*** 129,134 ****
  	_Py_ReadyTypes();
  
- <<<<<<< ../../2.2/src/./Python/pythonrun.c
- =======
  #ifdef STACKLESS
  	if (!_PyStackless_InitTypes()) {
--- 129,132 ----
***************
*** 138,148 ****
  #endif
  
- 	if (!_PyFrame_Init())
- 		Py_FatalError("Py_Initialize: can't init frames");
- 
- 	if (!_PyInt_Init())
- 		Py_FatalError("Py_Initialize: can't init ints");
- 
- >>>>>>> ././Python/pythonrun.c
  	interp->modules = PyDict_New();
  	if (interp->modules == NULL)
--- 136,139 ----


_______________________________________________
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