Skip to content

Fix issubclass() to narrow down types of type variables #7930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 14, 2019
Merged
Prev Previous commit
Next Next commit
Remove redundant parens
  • Loading branch information
ilevkivskyi authored Nov 14, 2019
commit 8ab0d96b8d2d53557c65e1b60d76a8396c9dd5e7
2 changes: 1 addition & 1 deletion mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4178,7 +4178,7 @@ def infer_issubclass_maps(self, node: CallExpr,
"""Infer type restrictions for an expression in issubclass call."""
vartype = type_map[expr]
type = get_isinstance_type(node.args[1], type_map)
if (isinstance(vartype, TypeVarType)):
if isinstance(vartype, TypeVarType):
vartype = vartype.upper_bound
vartype = get_proper_type(vartype)
if isinstance(vartype, UnionType):
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy