Skip to content

Commit ffb4b37

Browse files
committed
Fix test errors + update typeshed patch
1 parent 4d158e0 commit ffb4b37

3 files changed

Lines changed: 46 additions & 7 deletions

File tree

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

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,52 @@
1-
From 59841ad393c749cce0da8cd270f8d3f672637e20 Mon Sep 17 00:00:00 2001
1+
From 8c95839ee9db3bc899c6a19427253f6efbca3214 Mon Sep 17 00:00:00 2001
22
From: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
33
Date: Wed, 18 Feb 2026 13:11:02 +0100
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/dis.pyi | 4 ++--
9+
mypy/typeshed/stdlib/inspect.pyi | 4 ++--
10+
mypy/typeshed/stdlib/time.pyi | 6 +++---
11+
3 files changed, 7 insertions(+), 7 deletions(-)
1012

13+
diff --git a/mypy/typeshed/stdlib/dis.pyi b/mypy/typeshed/stdlib/dis.pyi
14+
index 984f932e3..a2831f11d 100644
15+
--- a/mypy/typeshed/stdlib/dis.pyi
16+
+++ b/mypy/typeshed/stdlib/dis.pyi
17+
@@ -2,7 +2,7 @@ import sys
18+
import types
19+
from collections.abc import Callable, Iterator
20+
from opcode import * # `dis` re-exports it as a part of public API
21+
-from typing import IO, Any, Final, NamedTuple, TypeAlias, overload
22+
+from typing import IO, Any, Final, NamedTuple, Union, overload
23+
from typing_extensions import Self, deprecated, disjoint_base
24+
25+
__all__ = [
26+
@@ -41,7 +41,7 @@ else:
27+
28+
# Strictly this should not have to include Callable, but mypy doesn't use FunctionType
29+
# for functions (python/mypy#3171)
30+
-_HaveCodeType: TypeAlias = types.MethodType | types.FunctionType | types.CodeType | type | Callable[..., Any]
31+
+_HaveCodeType = Union[types.MethodType, types.FunctionType, types.CodeType, type, Callable[..., Any]]
32+
33+
if sys.version_info >= (3, 11):
34+
class Positions(NamedTuple):
35+
diff --git a/mypy/typeshed/stdlib/inspect.pyi b/mypy/typeshed/stdlib/inspect.pyi
36+
index cc39a7c9f..0ca4cff75 100644
37+
--- a/mypy/typeshed/stdlib/inspect.pyi
38+
+++ b/mypy/typeshed/stdlib/inspect.pyi
39+
@@ -196,8 +196,8 @@ if sys.version_info >= (3, 14):
40+
41+
modulesbyfile: dict[str, Any]
42+
43+
-_GetMembersPredicateTypeGuard: TypeAlias = Callable[[Any], TypeGuard[_T]]
44+
-_GetMembersPredicateTypeIs: TypeAlias = Callable[[Any], TypeIs[_T]]
45+
+_GetMembersPredicateTypeGuard = Callable[[Any], TypeGuard[_T]]
46+
+_GetMembersPredicateTypeIs = Callable[[Any], TypeIs[_T]]
47+
_GetMembersPredicate: TypeAlias = Callable[[Any], bool]
48+
_GetMembersReturn: TypeAlias = list[tuple[str, _T]]
49+
1150
diff --git a/mypy/typeshed/stdlib/time.pyi b/mypy/typeshed/stdlib/time.pyi
1251
index ac53089b8..9b5344b32 100644
1352
--- a/mypy/typeshed/stdlib/time.pyi

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, Union, 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 = Union[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

0 commit comments

Comments
 (0)