diff options
Diffstat (limited to 'astroid/node_classes.py')
| -rw-r--r-- | astroid/node_classes.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/astroid/node_classes.py b/astroid/node_classes.py index 4e5f5612..0ab9be08 100644 --- a/astroid/node_classes.py +++ b/astroid/node_classes.py @@ -1217,8 +1217,16 @@ class LookupMixIn: # want to clear previous assignments if any (hence the test on # optional_assign) if not (optional_assign or are_exclusive(_stmts[pindex], node)): - del _stmt_parents[pindex] - del _stmts[pindex] + if ( + # In case of partial function node, if the statement is different + # from the origin function then it can be deleted otherwise it should + # remain to be able to correctly infer the call to origin function. + not node.is_function + or node.qname() != "PartialFunction" + or node.name != _stmts[pindex].name + ): + del _stmt_parents[pindex] + del _stmts[pindex] if isinstance(node, AssignName): if not optional_assign and stmt.parent is mystmt.parent: _stmts = [] |
