This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients christian.heimes, docs@python, steve.dower, terry.reedy
Date 2019-11-23.02:44:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1574477065.39.0.949630631325.issue38892@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-11-23 02:44:25terry.reedysetrecipients: + terry.reedy, christian.heimes, docs@python, steve.dower
2019-11-23 02:44:25terry.reedysetmessageid: <1574477065.39.0.949630631325.issue38892@roundup.psfhosted.org>
2019-11-23 02:44:25terry.reedylinkissue38892 messages
2019-11-23 02:44:24terry.reedycreate