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

Fix disallow-any errors for Instance types (PEP 696) by cdce8p · Pull Request #16832 · python/mypy · GitHub

Repository navigation

Fix disallow-any errors for Instance types (PEP 696) - #16832

Merged
JelleZijlstra merged 2 commits into
python:masterfrom
cdce8p:TypeVar-07-fix-disallow-any
Jan 31, 2024
Merged

JelleZijlstra merged 2 commits into
python:masterfrom
cdce8p:TypeVar-07-fix-disallow-any

Conversation

cdce8p commented Jan 28, 2024 •
edited
Loading

Copy link
Copy Markdown
Collaborator

Similar to TypeAlias types Missing type parameters for generic type should not be emitted if too many arguments are given. There is a separate error message for that.

Ref: #14851

This comment has been minimized.

cdce8p force-pushed the TypeVar-07-fix-disallow-any branch from 2b21ed3 to 308e87a Compare January 31, 2024 16:12

cdce8p commented Jan 31, 2024

Copy link
Copy Markdown
Collaborator Author

/CC @JelleZijlstra


def func_c4(
a: ClassC4,
a: ClassC4, # E: Missing type parameters for generic type "ClassC4[()]"

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

Why the [()] part?

Copy link
Copy Markdown
Collaborator Author

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

Adjusted the type formatting to better handle this case. It was just checking if the instance has a TypeVarTuple and assumed that it's the only TypeVar -> thus printing () for an empty tuple.

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

Thanks!

This comment has been minimized.

cdce8p requested a review from JelleZijlstra January 31, 2024 21:30

Copy link
Copy Markdown
Contributor

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

cdce8p added the topic-pep-696 TypeVar defaults label Jan 31, 2024
JelleZijlstra merged commit c3cd83a into python:master Jan 31, 2024
cdce8p deleted the TypeVar-07-fix-disallow-any branch January 31, 2024 23:08
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

topic-pep-696 TypeVar defaults

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL