@@ -3,7 +3,7 @@ import sys
3
3
from _typeshed import BytesPath , ExcInfo , FileDescriptorOrPath , StrOrBytesPath , StrPath , SupportsRead , SupportsWrite
4
4
from collections .abc import Callable , Iterable , Sequence
5
5
from tarfile import _TarfileFilter
6
- from typing import Any , AnyStr , NamedTuple , Protocol , TypeVar , overload
6
+ from typing import Any , AnyStr , NamedTuple , NoReturn , Protocol , TypeVar , overload
7
7
from typing_extensions import TypeAlias , deprecated
8
8
9
9
__all__ = [
@@ -36,7 +36,6 @@ __all__ = [
36
36
]
37
37
38
38
_StrOrBytesPathT = TypeVar ("_StrOrBytesPathT" , bound = StrOrBytesPath )
39
- _StrPathT = TypeVar ("_StrPathT" , bound = StrPath )
40
39
# Return value of some functions that may either return a path-like object that was passed in or
41
40
# a string
42
41
_PathReturn : TypeAlias = Any
@@ -185,8 +184,13 @@ else:
185
184
@overload
186
185
def chown (path : FileDescriptorOrPath , user : str | int , group : str | int ) -> None : ...
187
186
187
+ if sys .platform == "win32" and sys .version_info < (3 , 12 ):
188
+ @overload
189
+ @deprecated ("On Windows before Python 3.12, using a PathLike as `cmd` would always fail or return `None`." )
190
+ def which (cmd : os .PathLike [str ], mode : int = 1 , path : StrPath | None = None ) -> NoReturn : ...
191
+
188
192
@overload
189
- def which (cmd : _StrPathT , mode : int = 1 , path : StrPath | None = None ) -> str | _StrPathT | None : ...
193
+ def which (cmd : StrPath , mode : int = 1 , path : StrPath | None = None ) -> str | None : ...
190
194
@overload
191
195
def which (cmd : bytes , mode : int = 1 , path : StrPath | None = None ) -> bytes | None : ...
192
196
def make_archive (
0 commit comments