Created on 2020-09-24 08:23 by gchalony, last changed 2020-09-25 02:48 by Dennis Sweeney.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2020-09-25 02:48:48 | Dennis Sweeney | set | nosy:
+ Dennis Sweeney messages: + msg377475 |
| 2020-09-24 08:23:10 | gchalony | create | |
Created on 2020-09-24 08:23 by gchalony, last changed 2020-09-25 02:48 by Dennis Sweeney.
| Messages (2) | |||
|---|---|---|---|
| msg377442 - (view) | Author: Gregoire Chalony (gchalony) | Date: 2020-09-24 08:23 | |
The inspect module doesn't currently expose any way to access the block stack at runtime. Would that be possible? Aked on StackOverflow here: https://stackoverflow.com/questions/63187845/cpython-access-loop-depth-level-block-stack. |
|||
| msg377475 - (view) | Author: Dennis Sweeney (Dennis Sweeney) * | Date: 2020-09-25 02:48 | |
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. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2020-09-25 02:48:48 | Dennis Sweeney | set | nosy:
+ Dennis Sweeney messages: + msg377475 |
| 2020-09-24 08:23:10 | gchalony | create | |