[3.13] gh-119842: Honor PyOS_InputHook in the new REPL (GH-119843) (GH-120066)

(cherry picked from commit d9095194dd)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
This commit is contained in:
Łukasz Langa 2024-06-04 15:26:10 -04:00 committed by GitHub
parent 93b95e91fa
commit eea45ea213
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