diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index a79300956..7a7245396 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -56,6 +56,7 @@ from typing import ( Union, ValuesView, overload, + runtime_checkable, ) from typing_extensions import Literal @@ -1211,7 +1212,7 @@ if sys.version_info < (3,): # but we define it here as _PathLike to avoid import cycle issues. # See https://github.com/python/typeshed/pull/991#issuecomment-288160993 _AnyStr_co = TypeVar("_AnyStr_co", str, bytes, covariant=True) - +@runtime_checkable class _PathLike(Protocol[_AnyStr_co]): def __fspath__(self) -> _AnyStr_co: ... diff --git a/stdlib/2and3/builtins.pyi b/stdlib/2and3/builtins.pyi index a79300956..7a7245396 100644 --- a/stdlib/2and3/builtins.pyi +++ b/stdlib/2and3/builtins.pyi @@ -56,6 +56,7 @@ from typing import ( Union, ValuesView, overload, + runtime_checkable, ) from typing_extensions import Literal @@ -1211,7 +1212,7 @@ if sys.version_info < (3,): # but we define it here as _PathLike to avoid import cycle issues. # See https://github.com/python/typeshed/pull/991#issuecomment-288160993 _AnyStr_co = TypeVar("_AnyStr_co", str, bytes, covariant=True) - +@runtime_checkable class _PathLike(Protocol[_AnyStr_co]): def __fspath__(self) -> _AnyStr_co: ...