mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:21 +00:00
[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
2 changed files with 13 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue