[New-bugs-announce] [issue39182] sys.addaudithook(hook) loops indefinitely on mismatch for hook

Dutcho report at bugs.python.org
Wed Jan 1 12:23:00 EST 2020


New submission from Dutcho <dutcho at ziggo.nl>:

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 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.addaudithook(0)
error=10
Exception ignored in audit hook:
TypeError: 'int' object is not callable
  File "<stdin>", line 0
SyntaxError: unknown parsing error
error=10
Exception ignored in audit hook:
TypeError: 'int' object is not callable
  File "<stdin>", line 0
SyntaxError: unknown parsing error
error=10
Exception ignored in audit hook:
TypeError: 'int' object is not callable
  File "<stdin>", line 0
SyntaxError: unknown parsing error
... etc. ...

----------
messages: 359164
nosy: Dutcho
priority: normal
severity: normal
status: open
title: sys.addaudithook(hook) loops indefinitely on mismatch for hook
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39182>
_______________________________________


More information about the New-bugs-announce mailing list