diff Python/pystate.c @ 25633:efa9a86464d3 2.2

This is Armin Rigo's patch: [ 617309 ] getframe hook (Psyco #1) Forward port candidate.
author Michael W. Hudson <mwh@python.net>
date Mon, 07 Oct 2002 09:47:21 +0000
parents b0329649b8cf
children 63c6f45e947d
line wrap: on
line diff
--- a/Python/pystate.c	Mon Oct 07 09:40:20 2002 +0000
+++ b/Python/pystate.c	Mon Oct 07 09:47:21 2002 +0000
@@ -35,6 +35,7 @@
 static PyInterpreterState *interp_head = NULL;
 
 PyThreadState *_PyThreadState_Current = NULL;
+unaryfunc _PyThreadState_GetFrame = NULL;
 
 
 PyInterpreterState *
@@ -114,10 +115,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;