Steve Dower <steve.do...@python.org> added the comment:

I think this is specific to the interactive prompt. Under normal circumstances, 
any error in calling the hook at the point where an event is being audited 
(which is immediate when using interactive mode) needs to propagate.

Probably the best way to handle it is to call the hook with a new event 
indicating it's being added, but before it actually gets put into the list. A 
hook could then set up a different kind of loop, but it would be much harder to 
do it by accident.

Perhaps "sys.addaudithook/self" with itself as an argument. We can't just use 
"sys.addaudithook" in case there are hooks that blindly abort this event (which 
there are, because I've written them ;) ). But this will at least make sure 
that the signature is correct and shouldn't send the interactive parser into a 
loop.

----------
versions: +Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39182>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to