mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
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.
This commit is contained in:
parent
cad11a2bdc
commit
dc93d1125f
6 changed files with 36 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue