Skip to content

Commit 30c857a

Browse files
Add comment, add micro-optimization
1 parent 282467c commit 30c857a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pylint/checkers/base/name_checker/checker.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,12 +513,14 @@ def visit_assignname( # pylint: disable=too-many-branches,too-many-statements
513513
else:
514514
node_type = "variable"
515515
iattrs = tuple(node.frame().igetattr(node.name))
516-
attrs = tuple(node.frame().getattr(node.name))
517516
if (
518517
util.Uninferable in iattrs
519518
and self._name_regexps["const"].match(node.name) is not None
520519
):
521520
return
521+
# Do the exclusive assignment analysis on attrs, not iattrs.
522+
# iattrs locations could be anywhere (inference result).
523+
attrs = tuple(node.frame().getattr(node.name))
522524
if len(attrs) > 1 and all(
523525
astroid.are_exclusive(*combo)
524526
for combo in itertools.combinations(attrs, 2)

0 commit comments

Comments
 (0)