FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Do not allow `TypedDict` classes with extra keywords by sobolevn · Pull Request #16438 · python/mypy · GitHub

Repository navigation

Do not allow TypedDict classes with extra keywords - #16438

Merged
JelleZijlstra merged 3 commits into
python:masterfrom
sobolevn:issue-16432
Nov 18, 2023
Merged

JelleZijlstra merged 3 commits into
python:masterfrom
sobolevn:issue-16432

Conversation

sobolevn commented Nov 9, 2023

Copy link
Copy Markdown
Member

I think that sometimes metaclass= can still be used in real code, when people write compatibility layers with other metaclasses. I think that I've seen this a couple of times, but I cannot remember where and why.

In this case, this error can be precisely silenced.

AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

This comment has been minimized.

Comment thread mypy/semanal.py Outdated

This comment has been minimized.

This comment has been minimized.

Copy link
Copy Markdown
Member Author

I realized that I want to reuse existing messages:

» mypy -c 'class A(a=1, b=2): ...'
<string>:1: error: Unexpected keyword argument "a" for "__init_subclass__" of "object"  [call-arg]
<string>:1: error: Unexpected keyword argument "b" for "__init_subclass__" of "object"  [call-arg]
Found 2 errors in 1 file (checked 1 source file)

Comment thread test-data/unit/check-typeddict.test Outdated
sobolevn changed the title Do not allow TypedDict classes with metaclass= Do not allow TypedDict classes with extra keywords Nov 17, 2023

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL