Skip to content
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

Fix false positive on generic base class with six #14478

Merged
merged 1 commit into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2181,7 +2181,7 @@ def infer_metaclass_and_bases_from_compat_helpers(self, defn: ClassDef) -> None:
if len(defn.base_type_exprs) == 1:
base_expr = defn.base_type_exprs[0]
if isinstance(base_expr, CallExpr) and isinstance(base_expr.callee, RefExpr):
base_expr.accept(self)
self.analyze_type_expr(base_expr)
if (
base_expr.callee.fullname
in {
Expand Down
13 changes: 13 additions & 0 deletions test-data/unit/check-classes.test
Original file line number Diff line number Diff line change
Expand Up @@ -5293,6 +5293,19 @@ class F(six.with_metaclass(t.M)): pass
class G: pass
[builtins fixtures/tuple.pyi]

[case testSixMetaclassGenericBase]
import six
import abc
from typing import TypeVar, Generic

T = TypeVar("T")

class C(six.with_metaclass(abc.ABCMeta, Generic[T])):
pass
class D(six.with_metaclass(abc.ABCMeta, C[T])):
pass
[builtins fixtures/tuple.pyi]

-- Special support for future.utils
-- --------------------------------

Expand Down