[issue39182] sys.addaudithook(hook) loops indefinitely on mismatch for hook

2020-01-04 Thread Steve Dower
Steve Dower added the comment: Right, IDLE doesn't call exec/compile until _after_ the code is submitted, while the regular prompt calls it first and passes stdin as the source file (which then does a buffered read). The loop occurs because the next action after an invalid input is to read

[issue39182] sys.addaudithook(hook) loops indefinitely on mismatch for hook

2020-01-03 Thread Terry J. Reedy
Terry J. Reedy added the comment: I wrote too soon. Entering anything at the next line prints TypeError: 'int' object is not callable twice and a lot of IDLE specific stuff, and not another prompt. I have to restart the remote execution process. -- _

[issue39182] sys.addaudithook(hook) loops indefinitely on mismatch for hook

2020-01-03 Thread Terry J. Reedy
Terry J. Reedy added the comment: > I think this is specific to the interactive prompt. In IDLE, which simulates interactive mode with repeated 'exec(user_code, namespace)', no error is printed, let alone a loop. >>> import sys >>> sys.addaudithook(0) >>> -- nosy: +terry.reedy _

[issue39182] sys.addaudithook(hook) loops indefinitely on mismatch for hook

2020-01-03 Thread Steve Dower
Steve Dower 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

[issue39182] sys.addaudithook(hook) loops indefinitely on mismatch for hook

2020-01-01 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +christian.heimes, steve.dower ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue39182] sys.addaudithook(hook) loops indefinitely on mismatch for hook

2020-01-01 Thread Dutcho
New submission from Dutcho : When hook is not a compatible callable, addaudithook() will loop forever. At the minimum, a check for being callable should be executed. Preferably, a non-compatible (i.e. signature != [[str, tuple], Any]) hook callable should also be detected. >py Python 3.8.1 (