Hooking Mechanism when Entering and Leaving a Try Block

Sven R. Kunze srkunze at mail.de
Thu Aug 13 08:28:01 CEST 2015


On 12.08.2015 20:44, Sven R. Kunze wrote:
> On 12.08.2015 18:11, Chris Angelico wrote:
>> Sounds to me like you want some sort of AST transform, possibly in an
>> import hook. Check out something like MacroPy for an idea of how
>> powerful this sort of thing can be.
>
> Sounds like I MacroPy would enable me to basically insert a function 
> call before and after each try: block at import time. Is that correct 
> so far? That sounds not so bad at all.
>
>
> However, if that only works due to importing it is not a solution. I 
> need to make sure I catch all try: blocks, the current stack is in 
> (and is about to step into).
>
> Ah yes, and it should work with Python 3 as well. 

Back to topic, please. :)


More information about the Python-list mailing list