[3.13] gh-123240: Raise input audit events in the new REPL (GH-123274) (#123737)

(cherry picked from commit aa1339aaaa)

Co-authored-by: sobolevn <mail@sobolevn.me>
This commit is contained in:
Miss Islington (bot) 2024-09-05 17:45:20 +02:00 committed by GitHub
parent f48746b204
commit 5e03734c94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -365,8 +365,12 @@ class _ReadlineWrapper:
except _error: except _error:
assert raw_input is not None assert raw_input is not None
return raw_input(prompt) return raw_input(prompt)
reader.ps1 = str(prompt) prompt_str = str(prompt)
return reader.readline(startup_hook=self.startup_hook) 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: def multiline_input(self, more_lines: MoreLinesCallable, ps1: str, ps2: str) -> str:
"""Read an input on possibly multiple lines, asking for more """Read an input on possibly multiple lines, asking for more

View File

@ -0,0 +1 @@
Raise audit events for the :func:`input` in the new REPL.