I don't know of a way to get the current global trace function. This could certainly cause trouble if you're trying to be compatible with other packages that want to use their own trace functions (like psyco, or debuggers). Does anyone know how to get the global trace?
On the other hand, the local trace function is in the f_trace attribute of a frame. It looks like global trace functions only get the "call" event, and are expected to return a local trace function that will receive "line" and "return" events, so you will need a global trace in order to set local traces (setting myframe.f_trace explicitly doesn't seem to do it). -- http://mail.python.org/mailman/listinfo/python-list