From 632ce2725724ccb5cefa6dd48107b9320d10c809 Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Tue, 7 Jul 2026 12:59:53 -0700 Subject: [PATCH] Fix variance inference issues caused by dataclass replace Fixes #17623 --- mypy/subtypes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/subtypes.py b/mypy/subtypes.py index 259bb3791deaf..2d97dd534d9f5 100644 --- a/mypy/subtypes.py +++ b/mypy/subtypes.py @@ -2278,7 +2278,7 @@ def infer_variance(info: TypeInfo, i: int) -> bool: self_type = fill_typevars(info) for member in all_non_object_members(info): # __mypy-replace is an implementation detail of the dataclass plugin - if member in ("__init__", "__new__", "__mypy-replace"): + if member in {"__init__", "__new__", "__replace__", "__mypy-replace"}: continue if isinstance(self_type, TupleType):