Message357357
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. |
|
Date |
User |
Action |
Args |
2019-11-23 02:44:25 | terry.reedy | set | recipients:
+ terry.reedy, christian.heimes, docs@python, steve.dower |
2019-11-23 02:44:25 | terry.reedy | set | messageid: <1574477065.39.0.949630631325.issue38892@roundup.psfhosted.org> |
2019-11-23 02:44:25 | terry.reedy | link | issue38892 messages |
2019-11-23 02:44:24 | terry.reedy | create | |
|