Profilers and debuggers need to traverse the frame stack, but the layout of the stack is an internal implementation detail.
However can make some limited promises to make porting tools between Python versions a bit easier.
In order to traverse the stack, the offset of the previous pointer needs to be known. To understand the frame, more information is needed.
Currently f_code must be a code object, but we could generalize it to allow other objects.
For example, the shim frame inserted on entry to _PyEval_EvalFrameDefault could have that field set to None indicating it should be skipped in tracebacks, etc.
The order of f_code and previous doesn't really matter, but have f_code first makes #100719 a bit simpler
Profilers and debuggers need to traverse the frame stack, but the layout of the stack is an internal implementation detail.
However can make some limited promises to make porting tools between Python versions a bit easier.
In order to traverse the stack, the offset of the
previous
pointer needs to be known. To understand the frame, more information is needed.@pablogsal
@Yhg1s
expressed interest in this.
Linked PRs
_PyInterpreterFrame
a bit, to assist generator improvement. #100988The text was updated successfully, but these errors were encountered: