diff -r 8a47d2322df0 Include/frameobject.h --- a/Include/frameobject.h Tue Apr 10 21:05:53 2012 -0400 +++ b/Include/frameobject.h Wed Apr 11 11:06:29 2012 +0100 @@ -37,7 +37,6 @@ macros in ceval.c for details of their use. */ PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; - PyThreadState *f_tstate; int f_lasti; /* Last instruction if called */ /* Call PyFrame_GetLineNumber() instead of reading this field directly. As of 2.3 f_lineno is only valid when tracing is diff -r 8a47d2322df0 Lib/test/test_sys.py --- a/Lib/test/test_sys.py Tue Apr 10 21:05:53 2012 -0400 +++ b/Lib/test/test_sys.py Wed Apr 11 11:06:29 2012 +0100 @@ -730,7 +730,7 @@ nfrees = len(x.f_code.co_freevars) extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\ ncells + nfrees - 1 - check(x, size(vh + '12P3i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P')) + check(x, size(vh + '11P3i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P')) # function def func(): pass check(func, size(h + '12P')) diff -r 8a47d2322df0 Objects/frameobject.c --- a/Objects/frameobject.c Tue Apr 10 21:05:53 2012 -0400 +++ b/Objects/frameobject.c Wed Apr 11 11:06:29 2012 +0100 @@ -706,7 +706,6 @@ Py_INCREF(locals); f->f_locals = locals; } - f->f_tstate = tstate; f->f_lasti = -1; f->f_lineno = code->co_firstlineno; diff -r 8a47d2322df0 Python/ceval.c --- a/Python/ceval.c Tue Apr 10 21:05:53 2012 -0400 +++ b/Python/ceval.c Wed Apr 11 11:06:29 2012 +0100 @@ -3741,7 +3741,7 @@ call_trace(Py_tracefunc func, PyObject *obj, PyFrameObject *frame, int what, PyObject *arg) { - register PyThreadState *tstate = frame->f_tstate; + register PyThreadState *tstate = PyThreadState_GET(); int result; if (tstate->tracing) return 0; @@ -3757,8 +3757,8 @@ PyObject * _PyEval_CallTracing(PyObject *func, PyObject *args) { - PyFrameObject *frame = PyEval_GetFrame(); - PyThreadState *tstate = frame->f_tstate; + PyThreadState *tstate = PyThreadState_GET(); + PyFrameObject *frame = tstate->frame; int save_tracing = tstate->tracing; int save_use_tracing = tstate->use_tracing; PyObject *result; diff -r 8a47d2322df0 Python/sysmodule.c --- a/Python/sysmodule.c Tue Apr 10 21:05:53 2012 -0400 +++ b/Python/sysmodule.c Wed Apr 11 11:06:29 2012 +0100 @@ -329,7 +329,7 @@ static PyObject * -call_trampoline(PyThreadState *tstate, PyObject* callback, +call_trampoline(PyObject* callback, PyFrameObject *frame, int what, PyObject *arg) { PyObject *args = PyTuple_New(3); @@ -364,12 +364,11 @@ profile_trampoline(PyObject *self, PyFrameObject *frame, int what, PyObject *arg) { - PyThreadState *tstate = frame->f_tstate; PyObject *result; if (arg == NULL) arg = Py_None; - result = call_trampoline(tstate, self, frame, what, arg); + result = call_trampoline(self, frame, what, arg); if (result == NULL) { PyEval_SetProfile(NULL, NULL); return -1; @@ -382,7 +381,6 @@ trace_trampoline(PyObject *self, PyFrameObject *frame, int what, PyObject *arg) { - PyThreadState *tstate = frame->f_tstate; PyObject *callback; PyObject *result; @@ -392,7 +390,7 @@ callback = frame->f_trace; if (callback == NULL) return 0; - result = call_trampoline(tstate, callback, frame, what, arg); + result = call_trampoline(callback, frame, what, arg); if (result == NULL) { PyEval_SetTrace(NULL, NULL); Py_XDECREF(frame->f_trace);