Skip to content

Commit 8323cd9

Browse files
committed
Fix test errors + update typeshed patch
1 parent dbb7928 commit 8323cd9

5 files changed

Lines changed: 74 additions & 10 deletions

File tree

misc/typeshed_patches/0001-Adjust-stubs-to-fix-mypy-lookup-error-due-to-circula.patch

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,77 @@
1-
From 59841ad393c749cce0da8cd270f8d3f672637e20 Mon Sep 17 00:00:00 2001
1+
From 8985351bf6f917db1a7b15ffed95ec2357d9819d Mon Sep 17 00:00:00 2001
22
From: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
3-
Date: Wed, 18 Feb 2026 13:11:02 +0100
3+
Date: Mon, 18 May 2026 17:33:09 +0200
44
Subject: [PATCH] Adjust stubs to fix mypy lookup error due to circular
55
dependencies in stubs
66

77
---
8-
mypy/typeshed/stdlib/time.pyi | 6 +++---
9-
1 file changed, 3 insertions(+), 3 deletions(-)
8+
mypy/typeshed/stdlib/__future__.pyi | 2 +-
9+
mypy/typeshed/stdlib/dis.pyi | 4 ++--
10+
mypy/typeshed/stdlib/inspect.pyi | 4 ++--
11+
mypy/typeshed/stdlib/itertools.pyi | 2 +-
12+
mypy/typeshed/stdlib/time.pyi | 6 +++---
13+
5 files changed, 9 insertions(+), 9 deletions(-)
1014

15+
diff --git a/mypy/typeshed/stdlib/__future__.pyi b/mypy/typeshed/stdlib/__future__.pyi
16+
index aa445d22b..a90cf1edd 100644
17+
--- a/mypy/typeshed/stdlib/__future__.pyi
18+
+++ b/mypy/typeshed/stdlib/__future__.pyi
19+
@@ -1,4 +1,4 @@
20+
-from typing import TypeAlias
21+
+from typing_extensions import TypeAlias
22+
23+
_VersionInfo: TypeAlias = tuple[int, int, int, str, int]
24+
25+
diff --git a/mypy/typeshed/stdlib/dis.pyi b/mypy/typeshed/stdlib/dis.pyi
26+
index 984f932e3..0ad928934 100644
27+
--- a/mypy/typeshed/stdlib/dis.pyi
28+
+++ b/mypy/typeshed/stdlib/dis.pyi
29+
@@ -2,7 +2,7 @@ import sys
30+
import types
31+
from collections.abc import Callable, Iterator
32+
from opcode import * # `dis` re-exports it as a part of public API
33+
-from typing import IO, Any, Final, NamedTuple, TypeAlias, overload
34+
+from typing import IO, Any, Final, NamedTuple, overload
35+
from typing_extensions import Self, deprecated, disjoint_base
36+
37+
__all__ = [
38+
@@ -41,7 +41,7 @@ else:
39+
40+
# Strictly this should not have to include Callable, but mypy doesn't use FunctionType
41+
# for functions (python/mypy#3171)
42+
-_HaveCodeType: TypeAlias = types.MethodType | types.FunctionType | types.CodeType | type | Callable[..., Any]
43+
+_HaveCodeType = types.MethodType | types.FunctionType | types.CodeType | type | Callable[..., Any]
44+
45+
if sys.version_info >= (3, 11):
46+
class Positions(NamedTuple):
47+
diff --git a/mypy/typeshed/stdlib/inspect.pyi b/mypy/typeshed/stdlib/inspect.pyi
48+
index cc39a7c9f..0ca4cff75 100644
49+
--- a/mypy/typeshed/stdlib/inspect.pyi
50+
+++ b/mypy/typeshed/stdlib/inspect.pyi
51+
@@ -196,8 +196,8 @@ if sys.version_info >= (3, 14):
52+
53+
modulesbyfile: dict[str, Any]
54+
55+
-_GetMembersPredicateTypeGuard: TypeAlias = Callable[[Any], TypeGuard[_T]]
56+
-_GetMembersPredicateTypeIs: TypeAlias = Callable[[Any], TypeIs[_T]]
57+
+_GetMembersPredicateTypeGuard = Callable[[Any], TypeGuard[_T]]
58+
+_GetMembersPredicateTypeIs = Callable[[Any], TypeIs[_T]]
59+
_GetMembersPredicate: TypeAlias = Callable[[Any], bool]
60+
_GetMembersReturn: TypeAlias = list[tuple[str, _T]]
61+
62+
diff --git a/mypy/typeshed/stdlib/itertools.pyi b/mypy/typeshed/stdlib/itertools.pyi
63+
index d26a4e1da..60e79bc2e 100644
64+
--- a/mypy/typeshed/stdlib/itertools.pyi
65+
+++ b/mypy/typeshed/stdlib/itertools.pyi
66+
@@ -23,7 +23,7 @@ _T10 = TypeVar("_T10")
67+
68+
_Step: TypeAlias = SupportsFloat | SupportsInt | SupportsIndex | SupportsComplex
69+
70+
-_Predicate: TypeAlias = Callable[[_T], object]
71+
+_Predicate = Callable[[_T], object]
72+
73+
# Technically count can take anything that implements a number protocol and has an add method
74+
# but we can't enforce the add method
1175
diff --git a/mypy/typeshed/stdlib/time.pyi b/mypy/typeshed/stdlib/time.pyi
1276
index ac53089b8..9b5344b32 100644
1377
--- a/mypy/typeshed/stdlib/time.pyi

mypy/typeshed/stdlib/__future__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import TypeAlias
1+
from typing_extensions import TypeAlias
22

33
_VersionInfo: TypeAlias = tuple[int, int, int, str, int]
44

mypy/typeshed/stdlib/dis.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import sys
22
import types
33
from collections.abc import Callable, Iterator
44
from opcode import * # `dis` re-exports it as a part of public API
5-
from typing import IO, Any, Final, NamedTuple, TypeAlias, overload
5+
from typing import IO, Any, Final, NamedTuple, overload
66
from typing_extensions import Self, deprecated, disjoint_base
77

88
__all__ = [
@@ -41,7 +41,7 @@ else:
4141

4242
# Strictly this should not have to include Callable, but mypy doesn't use FunctionType
4343
# for functions (python/mypy#3171)
44-
_HaveCodeType: TypeAlias = types.MethodType | types.FunctionType | types.CodeType | type | Callable[..., Any]
44+
_HaveCodeType = types.MethodType | types.FunctionType | types.CodeType | type | Callable[..., Any]
4545

4646
if sys.version_info >= (3, 11):
4747
class Positions(NamedTuple):

mypy/typeshed/stdlib/inspect.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ if sys.version_info >= (3, 14):
196196

197197
modulesbyfile: dict[str, Any]
198198

199-
_GetMembersPredicateTypeGuard: TypeAlias = Callable[[Any], TypeGuard[_T]]
200-
_GetMembersPredicateTypeIs: TypeAlias = Callable[[Any], TypeIs[_T]]
199+
_GetMembersPredicateTypeGuard = Callable[[Any], TypeGuard[_T]]
200+
_GetMembersPredicateTypeIs = Callable[[Any], TypeIs[_T]]
201201
_GetMembersPredicate: TypeAlias = Callable[[Any], bool]
202202
_GetMembersReturn: TypeAlias = list[tuple[str, _T]]
203203

mypy/typeshed/stdlib/itertools.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ _T10 = TypeVar("_T10")
2323

2424
_Step: TypeAlias = SupportsFloat | SupportsInt | SupportsIndex | SupportsComplex
2525

26-
_Predicate: TypeAlias = Callable[[_T], object]
26+
_Predicate = Callable[[_T], object]
2727

2828
# Technically count can take anything that implements a number protocol and has an add method
2929
# but we can't enforce the add method

0 commit comments

Comments
 (0)