gh-119842: Honor PyOS_InputHook in the new REPL (GH-119843)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
This commit is contained in:
Pablo Galindo Salgado 2024-06-04 19:32:43 +01:00 committed by GitHub
parent bf5e1065f4
commit d9095194dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 144 additions and 11 deletions

View file

@ -33,6 +33,7 @@ TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import IO
from typing import Callable
@dataclass
@ -134,8 +135,15 @@ class Console(ABC):
...
@abstractmethod
def wait(self) -> None:
"""Wait for an event."""
def wait(self, timeout: float | None) -> bool:
"""Wait for an event. The return value is True if an event is
available, False if the timeout has been reached. If timeout is
None, wait forever. The timeout is in milliseconds."""
...
@property
def input_hook(self) -> Callable[[], int] | None:
"""Returns the current input hook."""
...
@abstractmethod