summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/__main__.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-07-22 11:36:57 (GMT)
committerGitHub <noreply@github.com>2024-07-22 11:36:57 (GMT)
commit148beb6de904121350babeeee169ba0919a73371 (patch)
treea5323770ce37a44bc534ec8ffd48f598a45741fa /Lib/asyncio/__main__.py
parent82db81528c0e66d88d252e6a0eb4d9b1e686535a (diff)
downloadcpython-148beb6de904121350babeeee169ba0919a73371.zip
cpython-148beb6de904121350babeeee169ba0919a73371.tar.gz
cpython-148beb6de904121350babeeee169ba0919a73371.tar.bz2
[3.13] gh-121957: Emit audit events for `python -i` and `python -m asyncio` (GH-121958) (GH-122115)
Relatedly, emit the `cpython.run_startup` event from the Python version of `PYTHONSTARTUP` handling. (cherry picked from commit dc93d1125f594ac7aece98558eaf33d09c348519) Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Lib/asyncio/__main__.py')
-rw-r--r--Lib/asyncio/__main__.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/asyncio/__main__.py b/Lib/asyncio/__main__.py
index 8b5a4b8..111b7d9 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: