KEMBAR78
Change TypedDict fallback to `Mapping[str, object]` by JukkaL · Pull Request #5933 · python/mypy · GitHub
Skip to content

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.

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