Skip to content

Commit

Permalink
Support namedtuple.__replace__ in Python 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed May 17, 2024
1 parent 3b97e6e commit 160a9c7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mypy/semanal_namedtuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,12 @@ def add_method(
ret=selftype,
args=[Argument(var, var.type, EllipsisExpr(), ARG_NAMED_OPT) for var in vars],
)
if self.options.python_version >= (3, 13):
add_method(
"__replace__",
ret=selftype,
args=[Argument(var, var.type, EllipsisExpr(), ARG_NAMED_OPT) for var in vars],
)

def make_init_arg(var: Var) -> Argument:
default = default_items.get(var.name, None)
Expand Down

0 comments on commit 160a9c7

Please sign in to comment.