mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
[3.13] gh-119842: Honor PyOS_InputHook in the new REPL (GH-119843) (GH-120066)
(cherry picked from commit d9095194dd
)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
This commit is contained in:
parent
93b95e91fa
commit
eea45ea213
8 changed files with 144 additions and 11 deletions
|
@ -650,7 +650,15 @@ class Reader:
|
|||
self.dirty = True
|
||||
|
||||
while True:
|
||||
event = self.console.get_event(block)
|
||||
input_hook = self.console.input_hook
|
||||
if input_hook:
|
||||
input_hook()
|
||||
# We use the same timeout as in readline.c: 100ms
|
||||
while not self.console.wait(100):
|
||||
input_hook()
|
||||
event = self.console.get_event(block=False)
|
||||
else:
|
||||
event = self.console.get_event(block)
|
||||
if not event: # can only happen if we're not blocking
|
||||
return False
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue