Skip to content

Commit 3a9c9a0

Browse files
committed
Fix list mutability bug in MRO calculation
We were deleting stuff from MROs while computing others...
1 parent 87d5661 commit 3a9c9a0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

typemap/type_eval/_apply_generic.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Boxed:
2222
args: dict[Any, Any]
2323

2424
str_args: dict[str, Any] = dataclasses.field(init=False)
25-
mro: list[Boxed] = dataclasses.field(init=False)
25+
mro: tuple[Boxed, ...] = dataclasses.field(init=False)
2626

2727
def __post_init__(self):
2828
object.__setattr__(
@@ -153,7 +153,9 @@ def merge_boxed_mro[T](seqs: list[list[T]]) -> list[T]:
153153

154154

155155
def _compute_mro(C: Boxed) -> list[Boxed]:
156-
return merge_boxed_mro([[C]] + [b.mro for b in C.bases] + [list(C.bases)])
156+
return merge_boxed_mro(
157+
[[C]] + [list(b.mro) for b in C.bases] + [list(C.bases)]
158+
)
157159

158160

159161
def make_func(

0 commit comments

Comments
 (0)