Terry J. Reedy <[email protected]> added the comment:
I agree on consistency. I will make a PR for you to review.
Do you think a minimal code example might help? Running ...
import sys
def hook(name, args):
if name.startswith('compile'):
print(name, args)
sys.addaudithook(hook)
compile('a = 1', '<dummy>', 'exec')
# prints
compile (b'a = 1', '<dummy>')
My own interest is learning about the socket connecting an IDLE GUI process and
the user code run process. The following in the two startup files:
def hook(name, args):
if name.startswith('socket'):
print('I', name, args) # I/R in the IDLE/run processes.
sys.addaudithook(hook)
results in:
I socket.gethostname ()
R socket.gethostname ()
I socket.bind (<socket.socket fd=796, family=AddressFamily.AF_INET,
type=SocketKind.SOCK_STREAM, proto=0>, ('127.0.0.1', 0))
R socket.bind (<socket.socket fd=796, family=AddressFamily.AF_INET,
type=SocketKind.SOCK_STREAM, proto=0>, ('127.0.0.1', 0))
R socket.connect (<socket.socket fd=816, family=AddressFamily.AF_INET,
type=SocketKind.SOCK_STREAM, proto=0>, ('127.0.0.1', 62119))
I socket.__new__ (<socket.socket fd=-1, family=AddressFamily.AF_UNSPEC, type=0,
proto=0>, 2, 1, 0)
R socket.__new__ (<socket.socket fd=-1, family=AddressFamily.AF_UNSPEC, type=0,
proto=0>, 2, 1, 0)
To go further, I might wrap socket.socket.send/recv with functions that call
sys.audit.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38892>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com