diff options
author | Ćukasz Langa <lukasz@langa.pl> | 2024-07-22 13:04:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-22 13:04:08 +0200 |
commit | dc93d1125f594ac7aece98558eaf33d09c348519 (patch) | |
tree | db2bc23e9e74df4a9ce22a872c2825418597f57b /Lib/asyncio/__main__.py | |
parent | cad11a2bdceb6d4683ae5654ce555cdf5f191217 (diff) | |
download | cpython-dc93d1125f594ac7aece98558eaf33d09c348519.tar.gz cpython-dc93d1125f594ac7aece98558eaf33d09c348519.zip |
gh-121957: Emit audit events for `python -i` and `python -m asyncio` (GH-121958)
Relatedly, emit the `cpython.run_startup` event from the Python version of
`PYTHONSTARTUP` handling.
Diffstat (limited to 'Lib/asyncio/__main__.py')
-rw-r--r-- | Lib/asyncio/__main__.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/asyncio/__main__.py b/Lib/asyncio/__main__.py index 8b5a4b8f282..111b7d92367 100644 --- a/Lib/asyncio/__main__.py +++ b/Lib/asyncio/__main__.py @@ -91,6 +91,8 @@ class REPLThread(threading.Thread): console.write(banner) if startup_path := os.getenv("PYTHONSTARTUP"): + sys.audit("cpython.run_startup", startup_path) + import tokenize with tokenize.open(startup_path) as f: startup_code = compile(f.read(), startup_path, "exec") @@ -127,6 +129,8 @@ class REPLThread(threading.Thread): if __name__ == '__main__': + sys.audit("cpython.run_stdin") + if os.getenv('PYTHON_BASIC_REPL'): CAN_USE_PYREPL = False else: @@ -155,6 +159,7 @@ if __name__ == '__main__': interactive_hook = getattr(sys, "__interactivehook__", None) if interactive_hook is not None: + sys.audit("cpython.run_interactivehook", interactive_hook) interactive_hook() if interactive_hook is site.register_readline: |