mirror of https://github.com/astral-sh/ruff
[`pylint`] Avoid false-positive slot non-assignment for `__dict__` (`PLE0237`) (#10348)
Closes https://github.com/astral-sh/ruff/issues/10306.
This commit is contained in:
parent
02fc521369
commit
f8f56186b3
|
|
@ -54,3 +54,15 @@ class StudentE(StudentD):
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class StudentF(object):
|
||||||
|
__slots__ = ("name", "__dict__")
|
||||||
|
|
||||||
|
def __init__(self, name, middle_name):
|
||||||
|
self.name = name
|
||||||
|
self.middle_name = middle_name # [assigning-non-slot]
|
||||||
|
self.setup()
|
||||||
|
|
||||||
|
def setup(self):
|
||||||
|
pass
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ fn is_attributes_not_in_slots(body: &[Stmt]) -> Vec<AttributeAssignment> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if slots.is_empty() {
|
if slots.is_empty() || slots.contains("__dict__") {
|
||||||
return vec![];
|
return vec![];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue