https://github.com/python/cpython/commit/aa1339aaaa6363c38186defaa079d069b4cb08b2
commit: aa1339aaaa6363c38186defaa079d069b4cb08b2
branch: main
author: sobolevn <[email protected]>
committer: ambv <[email protected]>
date: 2024-09-05T17:17:24+02:00
summary:
gh-123240: Raise input audit events in the new REPL (#123274)
files:
A Misc/NEWS.d/next/Library/2024-08-24-00-03-01.gh-issue-123240.uFPG3l.rst
M Lib/_pyrepl/readline.py
diff --git a/Lib/_pyrepl/readline.py b/Lib/_pyrepl/readline.py
index 483eb1039fa062..dfacfd84999136 100644
--- a/Lib/_pyrepl/readline.py
+++ b/Lib/_pyrepl/readline.py
@@ -365,8 +365,12 @@ def input(self, prompt: object = "") -> str:
except _error:
assert raw_input is not None
return raw_input(prompt)
- reader.ps1 = str(prompt)
- return reader.readline(startup_hook=self.startup_hook)
+ prompt_str = str(prompt)
+ reader.ps1 = prompt_str
+ sys.audit("builtins.input", prompt_str)
+ result = reader.readline(startup_hook=self.startup_hook)
+ sys.audit("builtins.input/result", result)
+ return result
def multiline_input(self, more_lines: MoreLinesCallable, ps1: str, ps2:
str) -> str:
"""Read an input on possibly multiple lines, asking for more
diff --git
a/Misc/NEWS.d/next/Library/2024-08-24-00-03-01.gh-issue-123240.uFPG3l.rst
b/Misc/NEWS.d/next/Library/2024-08-24-00-03-01.gh-issue-123240.uFPG3l.rst
new file mode 100644
index 00000000000000..e6ea6c33f89762
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-08-24-00-03-01.gh-issue-123240.uFPG3l.rst
@@ -0,0 +1 @@
+Raise audit events for the :func:`input` in the new REPL.
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]