Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignability rule for unpacked kwargs is not enforced #9807

Closed
erictraut opened this issue Feb 3, 2025 · 1 comment
Closed

Assignability rule for unpacked kwargs is not enforced #9807

erictraut opened this issue Feb 3, 2025 · 1 comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working spec compliance

Comments

@erictraut
Copy link
Collaborator

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.

@erictraut erictraut added bug Something isn't working spec compliance labels Feb 3, 2025
erictraut added a commit that referenced this issue Feb 6, 2025
…n the dest type uses an unpacked TypedDict and the source does not accept `**kwargs`. The typing spec indicates that this should fail because TypedDicts are not closed. This addresses #9807.
erictraut added a commit that referenced this issue Feb 6, 2025
…n the dest type uses an unpacked TypedDict and the source does not accept `**kwargs`. The typing spec indicates that this should fail because TypedDicts are not closed. This addresses #9807. (#9824)
@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label Feb 6, 2025
@erictraut
Copy link
Collaborator Author

This is addressed in pyright 1.1.394.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working spec compliance
Projects
None yet
Development

No branches or pull requests

1 participant