Skip to content

Commit

Permalink
[pylint] Avoid false-positive slot non-assignment for __dict__ (`…
Browse files Browse the repository at this point in the history
…PLE0237`) (#10348)

Closes #10306.
  • Loading branch information
charliermarsh authored Mar 11, 2024
1 parent 02fc521 commit f8f5618
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,15 @@ def __init__(self, name, middle_name):

def setup(self):
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
Original file line number Diff line number Diff line change
Expand Up @@ -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![];
}

Expand Down

0 comments on commit f8f5618

Please sign in to comment.