Dennis Sweeney <sweeney.dennis...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue41850>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to