Skip to content

input audit hook is not called from new repl #123240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cfbolz opened this issue Aug 22, 2024 · 0 comments
Closed

input audit hook is not called from new repl #123240

cfbolz opened this issue Aug 22, 2024 · 0 comments
Labels
topic-repl Related to the interactive shell type-bug An unexpected behavior, bug, or error

Comments

@cfbolz
Copy link
Contributor

cfbolz commented Aug 22, 2024

Bug report

Bug description:

sorry, another pretty strange corner case that probably doesn't matter, but I still wanted to report it.

In the new repl, calling input does not trigger the audit-hook for input any more, because the builtin is replaced with a pyrepl-specific function:

cfbolz@triacontahedron:~/projects/cpython$ ./python 
Python 3.14.0a0 (heads/main-dirty:3d7b1a526d8, Aug 22 2024, 14:55:23) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> def audithook(name, *args):
...     if "input" in name: print(name, args)
...     
>>> import sys
>>> sys.addaudithook(audithook)
>>> input()
abcdef
'abcdef'
>>> 

Here's the old behaviour:

cfbolz@triacontahedron:~/projects/cpython$ python3
Python 3.11.6 (main, Apr 10 2024, 17:26:07) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> def audithook(name, *args):
...     if "input" in name: print(name, args)
... 
>>> sys.addaudithook(audithook)
>>> input()
builtins.input ((None,),)
abc
builtins.input/result (('abc',),)
'abc'

CPython versions tested on:

3.13, CPython main branch

Operating systems tested on:

Linux

Linked PRs

@cfbolz cfbolz added type-bug An unexpected behavior, bug, or error topic-repl Related to the interactive shell labels Aug 22, 2024
sobolevn added a commit to sobolevn/cpython that referenced this issue Aug 23, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 5, 2024
ambv pushed a commit that referenced this issue Sep 5, 2024
@ambv ambv closed this as completed Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-repl Related to the interactive shell type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants