mercurial/windows.py
changeset 49913 3fd5824f1177
parent 49912 2b1476714849
child 50952 18c8c18993f0
--- a/mercurial/windows.py	Fri Dec 16 22:07:02 2022 -0500
+++ b/mercurial/windows.py	Fri Dec 16 22:24:05 2022 -0500
@@ -14,6 +14,7 @@
 import stat
 import string
 import sys
+import typing
 import winreg  # pytype: disable=import-error
 
 from typing import (
@@ -27,6 +28,7 @@
     Optional,
     Pattern,
     Sequence,
+    Tuple,
     Union,
 )
 
@@ -59,6 +61,18 @@
 testpid = win32.testpid
 unlink = win32.unlink
 
+if typing.TYPE_CHECKING:
+    # Replace the various overloads that come along with aliasing stdlib methods
+    # with the narrow definition that we care about in the type checking phase
+    # only.  This ensures that both Windows and POSIX see only the definition
+    # that is actually available.
+    #
+    # Note that if we check pycompat.TYPE_CHECKING here, it is always False, and
+    # the methods aren't replaced.
+    def split(p: bytes) -> Tuple[bytes, bytes]:
+        raise NotImplementedError
+
+
 umask: int = 0o022