mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Fixed incompatible use of constrained TypeVar in tempfile. (#5043)
The TypeVar `_T` was being used as a type argument for `PathLike`, but `PathLike` requires that its type argument be constrained to `str` or `bytes`, and `_T` didn't provide any such constraint. The easy workaround is to use the TypeVar `AnyStr` instead. Co-authored-by: Eric Traut <erictr@microsoft.com>
This commit is contained in:
@@ -13,8 +13,7 @@ tempdir: Optional[str]
|
||||
template: str
|
||||
|
||||
_S = TypeVar("_S")
|
||||
_T = TypeVar("_T") # for pytype, define typevar in same file as alias
|
||||
_DirT = Union[_T, os.PathLike[_T]]
|
||||
_DirT = Union[AnyStr, os.PathLike[AnyStr]]
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
@overload
|
||||
|
||||
Reference in New Issue
Block a user