gh-121497: Make Pyrepl respect correctly the history with input hook set (#121498)

This commit is contained in:
Pablo Galindo Salgado 2024-07-13 11:42:14 +02:00 committed by GitHub
parent dc03ce797a
commit 4e36dd7d87
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