[issue41850] inspect.py: access block stack

Dennis Sweeney report at bugs.python.org
Thu Sep 24 22:48:48 EDT 2020


Dennis Sweeney <sweeney.dennis650 at gmail.com> added the comment:

I believe the block stack is only for catching exceptions. Loops do not interact with the block stack. Only SETUP_FINALLY adds to the block stack:

https://docs.python.org/3/library/dis.html#opcode-SETUP_FINALLY

Meanwhile, loops and conditionals and the like are compiled into goto-like jumps.

There may be some existing solution, but I'm not sure what. Maybe look at the traceback or ast modules.

----------
nosy: +Dennis Sweeney

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41850>
_______________________________________


More information about the Python-bugs-list mailing list