Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Parameter matching for unpacked TypedDict not enforced #9808

@erictraut

Description

@erictraut

The typing spec indicates that if a caller passes an unpacked (non-closed) TypedDict as an argument to a function that accepts a fixed set of keyword argument, it should result in an error because additional items may be present in the argument TypedDict.

# > Kwargs hinted with an unpacked TypedDict can only be passed to another function if the function
# > to which unpacked kwargs are being passed to has **kwargs in its signature as well,
# > because then additional keywords would not cause errors at runtime during function invocation. 
# > Otherwise, the type checker should generate an error.

For more details, refer to this pull request in 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