|
42 | 42 | from .windows_eventqueue import EventQueue
|
43 | 43 |
|
44 | 44 | try:
|
45 |
| - from ctypes import GetLastError, WinDLL, windll, WinError # type: ignore[attr-defined] |
| 45 | + from ctypes import get_last_error, GetLastError, WinDLL, windll, WinError # type: ignore[attr-defined] |
46 | 46 | except:
|
47 | 47 | # Keep MyPy happy off Windows
|
48 | 48 | from ctypes import CDLL as WinDLL, cdll as windll
|
49 | 49 |
|
50 | 50 | def GetLastError() -> int:
|
51 | 51 | return 42
|
52 | 52 |
|
| 53 | + def get_last_error() -> int: |
| 54 | + return 42 |
| 55 | + |
53 | 56 | class WinError(OSError): # type: ignore[no-redef]
|
54 | 57 | def __init__(self, err: int | None, descr: str | None = None) -> None:
|
55 | 58 | self.err = err
|
@@ -416,7 +419,7 @@ def _read_input(self, block: bool = True) -> INPUT_RECORD | None:
|
416 | 419 | if not block:
|
417 | 420 | ret = WaitForSingleObject(InHandle, 0)
|
418 | 421 | if ret == WAIT_FAILED:
|
419 |
| - raise WinError(ctypes.get_last_error()) |
| 422 | + raise WinError(get_last_error()) |
420 | 423 | elif ret == WAIT_TIMEOUT:
|
421 | 424 | return None
|
422 | 425 |
|
@@ -532,7 +535,7 @@ def wait(self, timeout: float | None) -> bool:
|
532 | 535 | timeout = int(timeout)
|
533 | 536 | ret = WaitForSingleObject(InHandle, timeout)
|
534 | 537 | if ret == WAIT_FAILED:
|
535 |
| - raise WinError(ctypes.get_last_error()) |
| 538 | + raise WinError(get_last_error()) |
536 | 539 |
|
537 | 540 | def repaint(self) -> None:
|
538 | 541 | raise NotImplementedError("No repaint support")
|
|
0 commit comments