Skip to content

Assignability rule for unpacked kwargs is not enforced #9807

@erictraut

Description

@erictraut

The typing spec indicates that a callable without a kwargs parameter cannot be assigned to a callable with a kwargs with an unpacked (non-closed) TypedDict.

# > The situation where the destination callable contains **kwargs: Unpack[TypedDict] and
# > the source callable doesn’t contain **kwargs should be disallowed. This is because,
# > we cannot be sure that additional keyword arguments are not being passed in when an instance of a subclass
# > had been assigned to a variable with a base class type and then unpacked in the destination callable invocation

For more details, see this PR to the conformance tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions