Skip to content

Commit 033c85d

Browse files
authored
Remove old cycle-prevention workaround (#14180)
This was used to prevent an import cycle that exists anyway nowadays via `_typeshed`.
1 parent e3cae53 commit 033c85d

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

stdlib/builtins.pyi

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import types
66
from _collections_abc import dict_items, dict_keys, dict_values
77
from _typeshed import (
88
AnnotationForm,
9-
AnyStr_co,
109
ConvertibleToFloat,
1110
ConvertibleToInt,
1211
FileDescriptorOrPath,
@@ -33,6 +32,7 @@ from _typeshed import (
3332
)
3433
from collections.abc import Awaitable, Callable, Iterable, Iterator, MutableSet, Reversible, Set as AbstractSet, Sized
3534
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
35+
from os import PathLike
3636
from types import CellType, CodeType, GenericAlias, TracebackType
3737

3838
# mypy crashes if any of {ByteString, Sequence, MutableSequence, Mapping, MutableMapping}
@@ -1353,11 +1353,6 @@ def breakpoint(*args: Any, **kws: Any) -> None: ...
13531353
def callable(obj: object, /) -> TypeIs[Callable[..., object]]: ...
13541354
def chr(i: int | SupportsIndex, /) -> str: ...
13551355

1356-
# We define this here instead of using os.PathLike to avoid import cycle issues.
1357-
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993
1358-
class _PathLike(Protocol[AnyStr_co]):
1359-
def __fspath__(self) -> AnyStr_co: ...
1360-
13611356
if sys.version_info >= (3, 10):
13621357
def aiter(async_iterable: SupportsAiter[_SupportsAnextT_co], /) -> _SupportsAnextT_co: ...
13631358

@@ -1378,7 +1373,7 @@ if sys.version_info >= (3, 10):
13781373
@overload
13791374
def compile(
13801375
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
1381-
filename: str | ReadableBuffer | _PathLike[Any],
1376+
filename: str | ReadableBuffer | PathLike[Any],
13821377
mode: str,
13831378
flags: Literal[0],
13841379
dont_inherit: bool = False,
@@ -1389,7 +1384,7 @@ def compile(
13891384
@overload
13901385
def compile(
13911386
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
1392-
filename: str | ReadableBuffer | _PathLike[Any],
1387+
filename: str | ReadableBuffer | PathLike[Any],
13931388
mode: str,
13941389
*,
13951390
dont_inherit: bool = False,
@@ -1399,7 +1394,7 @@ def compile(
13991394
@overload
14001395
def compile(
14011396
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
1402-
filename: str | ReadableBuffer | _PathLike[Any],
1397+
filename: str | ReadableBuffer | PathLike[Any],
14031398
mode: str,
14041399
flags: Literal[1024],
14051400
dont_inherit: bool = False,
@@ -1410,7 +1405,7 @@ def compile(
14101405
@overload
14111406
def compile(
14121407
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
1413-
filename: str | ReadableBuffer | _PathLike[Any],
1408+
filename: str | ReadableBuffer | PathLike[Any],
14141409
mode: str,
14151410
flags: int,
14161411
dont_inherit: bool = False,

0 commit comments

Comments
 (0)