[issue41850] inspect.py: access block stack

2021-12-28 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

With the advent of zero-cost exception handling in Python 3.10, there is no 
block stack, neither for exceptions nor for loops. These were always regarded 
as an implementation detail of the compiler. If you have any new ideas for a 
feature like this, I would suggest sending them to the Python-Ideas mailing 
list, but I'm closing this for now.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41850] inspect.py: access block stack

2020-09-24 Thread Dennis Sweeney


Dennis Sweeney  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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41850] inspect.py: access block stack

2020-09-24 Thread Gregoire Chalony


New submission from Gregoire Chalony :

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.

--
messages: 377442
nosy: gchalony
priority: normal
severity: normal
status: open
title: inspect.py: access block stack
type: enhancement
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com