I'm having trouble understanding the differences between stack frames and execution frames, mostly with respect to the traceback
and inspect
modules (in Python 3).
I thought they were the same but the docs imply they are not as methods of the inspect
module return frame objects whereas methods of the traceback
module do not (i.e. inspect.stack()
vs traceback.print_stack()
.
From googling, I understand that a stack frame is a data structure containing subroutine state information (function call and argument data). However, as per the docs, an an execution frame is something similar:
An execution frame contains some administrative information (used for debugging), determines where and how execution continues after the code block's execution has completed, and (perhaps most importantly) defines two namespaces, the local and the global namespace, that affect execution of the code block.
So what exactly is the difference between a stack frame and an execution frame?