summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/_pyrepl/unix_console.py4
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2024-07-08-17-15-14.gh-issue-121497.I8hMDC.rst2
2 files changed, 4 insertions, 2 deletions
diff --git a/Lib/_pyrepl/unix_console.py b/Lib/_pyrepl/unix_console.py
index c4dedd9..18b2bba 100644
--- a/Lib/_pyrepl/unix_console.py
+++ b/Lib/_pyrepl/unix_console.py
@@ -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:
diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-07-08-17-15-14.gh-issue-121497.I8hMDC.rst b/Misc/NEWS.d/next/Core and Builtins/2024-07-08-17-15-14.gh-issue-121497.I8hMDC.rst
new file mode 100644
index 0000000..33de31a
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2024-07-08-17-15-14.gh-issue-121497.I8hMDC.rst
@@ -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