Skip to content

Dataclasses should define __replace__ in 3.13 #17471

Description

@max-muoto

Feature

Add __replace__ on dataclasses in 3.13+.

Pitch

Similar to how we're special casing support for __replace__ on namedtuple, we should do the same for dataclasses.

This is causing some false positive issues in TypeShed, where __replace__ isn't getting registered on dataclasses (FunctionProfile and StatsProfile) and is needed to properly support the protocol for copy.replace: python/typeshed#12262

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions