diff options
Diffstat (limited to 'pylint/checkers/classes.py')
-rw-r--r-- | pylint/checkers/classes.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index 4bbc45f20..478197b0f 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -1487,6 +1487,14 @@ a metaclass class method.", return if "__slots__" not in klass.locals or not klass.newstyle: return + # If `__setattr__` is defined on the class, then we can't reason about + # what will happen when assigning to an attribute. + if any( + base.locals.get("__setattr__") + for base in klass.mro() + if base.qname() != "builtins.object" + ): + return # If 'typing.Generic' is a base of bases of klass, the cached version # of 'slots()' might have been evaluated incorrectly, thus deleted cache entry. |