diff --git a/_nodes_ast.py b/_nodes_ast.py index d852f5f7e8..c02d0129f8 100644 --- a/_nodes_ast.py +++ b/_nodes_ast.py @@ -200,6 +200,7 @@ def _visit_assign(self, node): def visit_augassign(self, node): """visit a AugAssign node by returning a fresh instance of it""" newnode = new.AugAssign() + newnode.op = _BIN_OP_CLASSES[node.op.__class__] newnode.target = self.visit(node.target, node) newnode.value = self.visit(node.value, node) return newnode @@ -237,7 +238,7 @@ def visit_callfunc(self, node): newnode.args = [self.visit(child, node) for child in node.args] newnode.starargs = self.visit(node.starargs, node) newnode.kwargs = self.visit(node.kwargs, node) - newnode.args.extend(node.keywords) + newnode.args.extend(self.visit(child, node) for child in node.keywords) return newnode def _visit_class(self, node): @@ -422,6 +423,7 @@ def visit_index(self, node): def visit_keyword(self, node): """visit a Keyword node by returning a fresh instance of it""" newnode = new.Keyword() + newnode.arg = node.arg newnode.value = self.visit(node.value, node) return newnode diff --git a/node_classes.py b/node_classes.py index b42589bde0..1081d5e287 100644 --- a/node_classes.py +++ b/node_classes.py @@ -373,7 +373,7 @@ class From(FromImportMixIn, StmtMixIn, NodeNG): """class representing a From node""" def __init__(self, fromname, names): - self.fromname = fromname + self.modname = fromname self.names = names class Getattr(NodeNG): diff --git a/nodes_as_string.py b/nodes_as_string.py index eb2f311633..27535a625f 100644 --- a/nodes_as_string.py +++ b/nodes_as_string.py @@ -81,7 +81,7 @@ def visit_assign(self, node): def visit_augassign(self, node): """return an astng.AugAssign node as string""" - return '%s %s %s' % (node.target.accept(self), node.op, node.value.accept(self)) + return '%s %s= %s' % (node.target.accept(self), node.op, node.value.accept(self)) def visit_backquote(self, node): """return an astng.Backquote node as string"""