Closed as not planned
Closed as not planned
Description
It would be easy enough to tag code objects that do not have explicit try
statements.
We could skip the throw step when closing generators for such code objects.
Before "zero cost" exceptions, we checked the the block stack. If it was empty we would skip the throw step.
We could be something similar by checking the exception table, but the introduction of a generator wide implicit try-except to handle https://peps.python.org/pep-0479/ complicates this.
See #100762 for the genesis of this.
Generator expressions never have try
s and tend to be short lived, so this would definitely help there.