Skip to content

Support TypedDict functional syntax as class base type#16703

Merged
hauntsaninja merged 2 commits intopython:masterfrom
anniel-stripe:master
Jan 14, 2024
Merged

Support TypedDict functional syntax as class base type#16703
hauntsaninja merged 2 commits intopython:masterfrom
anniel-stripe:master

Conversation

@anniel-stripe
Copy link
Copy Markdown
Contributor

@anniel-stripe anniel-stripe commented Dec 22, 2023

Fixes #16701

This PR allows TypedDict(...) calls to be used as a base class. This fixes the error emitted by mypy described in #16701 .

@github-actions
Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

steam.py (https://github.com/Gobot1234/steam.py)
- steam/types/app.py:171: error: Unsupported dynamic base class "TypedDict"  [misc]
- steam/types/app.py:173: error: NotRequired[] can be only used in a TypedDict definition  [valid-type]
- steam/types/app.py:177: error: NotRequired[] can be only used in a TypedDict definition  [valid-type]
- steam/types/app.py:178: error: NotRequired[] can be only used in a TypedDict definition  [valid-type]

@anniel-stripe
Copy link
Copy Markdown
Contributor Author

Sorry for the direct mention, but bumping @JukkaL / @hauntsaninja

Copy link
Copy Markdown
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Thanks! Looks like pyright supports this syntax as well

@hauntsaninja hauntsaninja merged commit b1fe23f into python:master Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow TypedDict functional syntax as base class

2 participants