diff Python/pystate.c @ 26109:e61b946474df legacy-trunk

Assorted patches from Armin Rigo: [ 617309 ] getframe hook (Psyco #1) [ 617311 ] Tiny profiling info (Psyco #2) [ 617312 ] debugger-controlled jumps (Psyco #3) These are forward ports from 2.2.2.
author Michael W. Hudson <mwh@python.net>
date Fri, 08 Nov 2002 12:53:11 +0000
parents b470b417839d
children 4b99a701defe
line wrap: on
line diff
--- a/Python/pystate.c	Fri Nov 08 12:09:59 2002 +0000
+++ b/Python/pystate.c	Fri Nov 08 12:53:11 2002 +0000
@@ -35,6 +35,7 @@
 static PyInterpreterState *interp_head = NULL;
 
 PyThreadState *_PyThreadState_Current = NULL;
+unaryfunc _PyThreadState_GetFrame = NULL;
 
 
 PyInterpreterState *
@@ -113,10 +114,19 @@
 }
 
 
+/* Default implementation for _PyThreadState_GetFrame */
+static struct _frame *
+threadstate_getframe(PyThreadState *self)
+{
+	return self->frame;
+}
+
 PyThreadState *
 PyThreadState_New(PyInterpreterState *interp)
 {
 	PyThreadState *tstate = PyMem_NEW(PyThreadState, 1);
+	if (_PyThreadState_GetFrame == NULL)
+		_PyThreadState_GetFrame = (unaryfunc)threadstate_getframe;
 
 	if (tstate != NULL) {
 		tstate->interp = interp;
@@ -125,6 +135,7 @@
 		tstate->recursion_depth = 0;
 		tstate->tracing = 0;
 		tstate->use_tracing = 0;
+		tstate->tick_counter = 0;
 
 		tstate->dict = NULL;