Skip to content

Commit d84a038

Browse files
authored
Revert addition of class_getitem to PathLike (#6591)
This was added in #5869 This breaks all PathLike classes that don't have class_getitem
1 parent b345843 commit d84a038

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

stdlib/os/__init__.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,6 @@ class stat_result:
331331
@runtime_checkable
332332
class PathLike(Protocol[_AnyStr_co]):
333333
def __fspath__(self) -> _AnyStr_co: ...
334-
if sys.version_info >= (3, 9):
335-
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
336334

337335
@overload
338336
def listdir(path: str | None = ...) -> list[str]: ...

tests/stubtest_allowlists/py310.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ ipaddress.IPv6Interface.hostmask
5151
ipaddress._BaseNetwork.broadcast_address
5252
ipaddress._BaseNetwork.hostmask
5353
multiprocessing.spawn._main
54+
os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem
5455
pickle.Pickler.reducer_override # implemented in C pickler
5556
# platform.uname_result's processor field is now dynamically made to exist
5657
platform.uname_result.__new__

tests/stubtest_allowlists/py39.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ ipaddress.IPv6Interface.hostmask
4646
ipaddress._BaseNetwork.broadcast_address
4747
ipaddress._BaseNetwork.hostmask
4848
multiprocessing.spawn._main
49+
os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem
4950
pickle.Pickler.reducer_override # implemented in C pickler
5051
# platform.uname_result's processor field is now dynamically made to exist
5152
platform.uname_result.__new__

0 commit comments

Comments
 (0)