Skip to content

Change TypedDict fallback to Mapping[str, object] #5933

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

Merged
merged 2 commits into from
Nov 22, 2018
Merged

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Nov 21, 2018

The previous fallback mapping item type was join of the value
types, which is unsafe because of structural subtyping.

Fixes #5927.

The previous fallback mapping item type was join of the value
types, which is unsafe because of structural subtyping.

Fixes #5927.
Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one random suggestion, otherwise looks good.

a: A
b: B
fun(a)
fun(b) # Error
fun(b)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep a test that a function that expects a protocol with __getitem__ -> int always fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants