KEMBAR78
Don't narrow Type[X] with a metaclass by JukkaL · Pull Request #10424 · python/mypy · GitHub
Skip to content

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented May 5, 2021

We could narrow Type[T] to <nothing> when tested against a
metaclass, which is not useful. Now we don't do any narrowing
in this case.

Fixes #10423.

We could narrow `Type[T]` to `<nothing>` when tested against a
metaclass, which is not useful. Now we don't do any narrowing
in this case.

Fixes #10423.
@github-actions
Copy link
Contributor

github-actions bot commented May 5, 2021

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

sphinx (https://github.com/sphinx-doc/sphinx.git)
+ sphinx/util/typing.py:226: error: unused 'type: ignore' comment
+ sphinx/util/typing.py:227: error: unused 'type: ignore' comment
+ sphinx/util/typing.py:228: error: unused 'type: ignore' comment
+ sphinx/util/typing.py:229: error: unused 'type: ignore' comment
+ sphinx/util/typing.py:231: error: unused 'type: ignore' comment
+ sphinx/util/typing.py:232: error: unused 'type: ignore' comment

@JukkaL JukkaL merged commit 6d2635d into master May 5, 2021
@JukkaL JukkaL deleted the narrow-metaclass branch May 5, 2021 13:15
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.

Narrowing types using a metaclass can cause false positives

2 participants