diff options
Diffstat (limited to 'astroid/protocols.py')
| -rw-r--r-- | astroid/protocols.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/astroid/protocols.py b/astroid/protocols.py index c9e2842d..0464f7e7 100644 --- a/astroid/protocols.py +++ b/astroid/protocols.py @@ -469,6 +469,12 @@ def _infer_context_manager(self, mgr, context, nodes): yield result +@assigned_stmts.register(treeabc.WithItem) +def withitem_assigned_stmts(self, nodes, node=None, context=None, asspath=None): + print(node, self, self.parent) + return self.parent.assigned_stmts(nodes, node=node, asspath=asspath) + + @assigned_stmts.register(treeabc.With) @decorators.raise_if_nothing_inferred def with_assigned_stmts(self, nodes, node=None, context=None, asspath=None): @@ -495,7 +501,11 @@ def with_assigned_stmts(self, nodes, node=None, context=None, asspath=None): context: TODO asspath: TODO """ - mgr = next(mgr for (mgr, vars) in self.items if vars == node) + print('SELF', self) + print('NODES', nodes) + print('NODE', node) + mgr = next(item.context_expr for item in self.items if + item.optional_vars == node) if asspath is None: for result in _infer_context_manager(self, mgr, context, nodes): yield result |
