Skip to content

Commit 4e36dd7

Browse files
authored
gh-121497: Make Pyrepl respect correctly the history with input hook set (#121498)
1 parent dc03ce7 commit 4e36dd7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Lib/_pyrepl/unix_console.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@ def get_event(self, block: bool = True) -> Event | None:
383383
Returns:
384384
- Event: Event object from the event queue.
385385
"""
386+
if not block and not self.wait(timeout=0):
387+
return None
386388
while self.event_queue.empty():
387389
while True:
388390
try:
@@ -397,8 +399,6 @@ def get_event(self, block: bool = True) -> Event | None:
397399
raise
398400
else:
399401
break
400-
if not block:
401-
break
402402
return self.event_queue.get()
403403

404404
def wait(self, timeout: float | None = None) -> bool:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix a bug that was preventing the REPL to correctly respect the history when
2+
an input hook was set. Patch by Pablo Galindo

0 commit comments

Comments
 (0)