From c30a7bca3c3655ef663b405dfe9756844922aa48 Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Wed, 15 Dec 2021 17:16:38 -0800 Subject: [PATCH 1/2] Revert addition of class_getitem to PathLike This was added in #5869 This breaks all PathLike classes that don't have class_getitem --- stdlib/os/__init__.pyi | 2 -- 1 file changed, 2 deletions(-) diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index 7289ac425f40..c68a587671a2 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -331,8 +331,6 @@ class stat_result: @runtime_checkable class PathLike(Protocol[_AnyStr_co]): def __fspath__(self) -> _AnyStr_co: ... - if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any) -> GenericAlias: ... @overload def listdir(path: str | None = ...) -> list[str]: ... From d9d97c0460f2e9d82fa8b749660a9626c7263208 Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Wed, 15 Dec 2021 17:23:35 -0800 Subject: [PATCH 2/2] allowlist --- tests/stubtest_allowlists/py310.txt | 1 + tests/stubtest_allowlists/py39.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/stubtest_allowlists/py310.txt b/tests/stubtest_allowlists/py310.txt index 03b972214117..abcec51eb097 100644 --- a/tests/stubtest_allowlists/py310.txt +++ b/tests/stubtest_allowlists/py310.txt @@ -51,6 +51,7 @@ ipaddress.IPv6Interface.hostmask ipaddress._BaseNetwork.broadcast_address ipaddress._BaseNetwork.hostmask multiprocessing.spawn._main +os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem pickle.Pickler.reducer_override # implemented in C pickler # platform.uname_result's processor field is now dynamically made to exist platform.uname_result.__new__ diff --git a/tests/stubtest_allowlists/py39.txt b/tests/stubtest_allowlists/py39.txt index 35480dc7ea65..630414b832d4 100644 --- a/tests/stubtest_allowlists/py39.txt +++ b/tests/stubtest_allowlists/py39.txt @@ -46,6 +46,7 @@ ipaddress.IPv6Interface.hostmask ipaddress._BaseNetwork.broadcast_address ipaddress._BaseNetwork.hostmask multiprocessing.spawn._main +os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem pickle.Pickler.reducer_override # implemented in C pickler # platform.uname_result's processor field is now dynamically made to exist platform.uname_result.__new__