From 257dc6c9e5059bfde9bf5b8f39f3f7d8b1cf0426 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Tue, 28 Dec 2021 19:12:24 +0000 Subject: [PATCH 1/4] No crash is caused for the vast majority of `collections.abc` imports --- stdlib/builtins.pyi | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index cf5799238b76..bc9ec7d55d1f 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -22,27 +22,29 @@ from _typeshed import ( SupportsTrunc, SupportsWrite, ) +from collections.abc import ( + ByteString, + Callable, + Iterable, + Iterator, + Mapping, + MutableMapping, + MutableSet, + Reversible, + Set as AbstractSet, + Sized, +) from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper from types import CodeType, TracebackType from typing import ( IO, - AbstractSet, Any, BinaryIO, - ByteString, - Callable, Generic, - Iterable, - Iterator, - Mapping, - MutableMapping, MutableSequence, - MutableSet, NoReturn, Protocol, - Reversible, Sequence, - Sized, SupportsAbs, SupportsBytes, SupportsComplex, From 83646a64e4d5c23e5ba172182e015299ac403b8e Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Tue, 28 Dec 2021 19:16:49 +0000 Subject: [PATCH 2/4] Importing `Sequence` from `collections.abc` causes a mypy crash --- stdlib/builtins.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index bc9ec7d55d1f..c6e13d954b29 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -31,6 +31,7 @@ from collections.abc import ( MutableMapping, MutableSet, Reversible, + Sequence, Set as AbstractSet, Sized, ) @@ -44,7 +45,6 @@ from typing import ( MutableSequence, NoReturn, Protocol, - Sequence, SupportsAbs, SupportsBytes, SupportsComplex, From 57361f1554a3d432d2f69edf12241274d31b86bf Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Tue, 28 Dec 2021 19:19:17 +0000 Subject: [PATCH 3/4] Importing `MutableSequence` from `collections.abc` also causes a crash --- stdlib/builtins.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index c6e13d954b29..4571454e1f74 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -29,9 +29,9 @@ from collections.abc import ( Iterator, Mapping, MutableMapping, + MutableSequence, MutableSet, Reversible, - Sequence, Set as AbstractSet, Sized, ) @@ -42,9 +42,9 @@ from typing import ( Any, BinaryIO, Generic, - MutableSequence, NoReturn, Protocol, + Sequence, SupportsAbs, SupportsBytes, SupportsComplex, From 4506274fd187a60f927783832137b421c6d8e96c Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Tue, 28 Dec 2021 19:22:21 +0000 Subject: [PATCH 4/4] Importing `Sequence` and `MutableSequence` from `collections.abc` also causes a crash --- stdlib/builtins.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 4571454e1f74..6bae5c507e87 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -32,6 +32,7 @@ from collections.abc import ( MutableSequence, MutableSet, Reversible, + Sequence, Set as AbstractSet, Sized, ) @@ -44,7 +45,6 @@ from typing import ( Generic, NoReturn, Protocol, - Sequence, SupportsAbs, SupportsBytes, SupportsComplex,