summaryrefslogtreecommitdiffstats
path: root/Lib/_pyrepl
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2024-07-13 09:42:14 (GMT)
committerGitHub <noreply@github.com>2024-07-13 09:42:14 (GMT)
commit4e36dd7d87eb0f1bd1ecd53e368c16a5f75967a0 (patch)
tree555f95a9da1df07a40092c011ddbf8589997ebd9 /Lib/_pyrepl
parentdc03ce797ae8786a9711e6ee5dcaadde02c55864 (diff)
downloadcpython-4e36dd7d87eb0f1bd1ecd53e368c16a5f75967a0.zip
cpython-4e36dd7d87eb0f1bd1ecd53e368c16a5f75967a0.tar.gz
cpython-4e36dd7d87eb0f1bd1ecd53e368c16a5f75967a0.tar.bz2
gh-121497: Make Pyrepl respect correctly the history with input hook set (#121498)
Diffstat (limited to 'Lib/_pyrepl')
-rw-r--r--Lib/_pyrepl/unix_console.py4
1 files changed, 2 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: