diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-09-05 15:45:20 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-05 15:45:20 (GMT) |
| commit | 5e03734c947e7bf98b57016c237a478af5e67c55 (patch) | |
| tree | ade38a645bb93b31c8aa274060e45eb5798c486a | |
| parent | f48746b204d3ca089860fe8ac2f0ef613a198116 (diff) | |
| download | cpython-5e03734c947e7bf98b57016c237a478af5e67c55.zip cpython-5e03734c947e7bf98b57016c237a478af5e67c55.tar.gz cpython-5e03734c947e7bf98b57016c237a478af5e67c55.tar.bz2 | |
[3.13] gh-123240: Raise input audit events in the new REPL (GH-123274) (#123737)
(cherry picked from commit aa1339aaaa6363c38186defaa079d069b4cb08b2)
Co-authored-by: sobolevn <mail@sobolevn.me>
| -rw-r--r-- | Lib/_pyrepl/readline.py | 8 | ||||
| -rw-r--r-- | Misc/NEWS.d/next/Library/2024-08-24-00-03-01.gh-issue-123240.uFPG3l.rst | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/Lib/_pyrepl/readline.py b/Lib/_pyrepl/readline.py index 483eb10..dfacfd8 100644 --- a/Lib/_pyrepl/readline.py +++ b/Lib/_pyrepl/readline.py @@ -365,8 +365,12 @@ class _ReadlineWrapper: 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 0000000..e6ea6c3 --- /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. |
