[3.13] gh-121497: Make Pyrepl respect correctly the history with input hook set (GH-121498) (#121703)

gh-121497: Make Pyrepl respect correctly the history with input hook set (GH-121498)
(cherry picked from commit 4e36dd7d87)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-07-13 16:28:49 +02:00 committed by GitHub
parent de51ee0c23
commit 62572f10aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -383,6 +383,8 @@ class UnixConsole(Console):
Returns:
- Event: Event object from the event queue.
"""
if not block and not self.wait(timeout=0):
return None
while self.event_queue.empty():
while True:
try:
@ -397,8 +399,6 @@ class UnixConsole(Console):
raise
else:
break
if not block:
break
return self.event_queue.get()
def wait(self, timeout: float | None = None) -> bool:

View File

@ -0,0 +1,2 @@
Fix a bug that was preventing the REPL to correctly respect the history when
an input hook was set. Patch by Pablo Galindo