summaryrefslogtreecommitdiff
path: root/rebuilder.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2014-01-27 15:56:40 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2014-01-27 15:56:40 +0200
commit0790b5662730f1678ae9cafd938652d7a3f883dc (patch)
tree8970201cba4581690acc031d68586d12b0a48d84 /rebuilder.py
parent558ff686832d1634c1fceac7897524f3c23be502 (diff)
downloadastroid-git-0790b5662730f1678ae9cafd938652d7a3f883dc.tar.gz
vararg and kwarg are instances of _arg.arg for Python 3.4, not strings.
--HG-- branch : nameconstant_py34
Diffstat (limited to 'rebuilder.py')
-rw-r--r--rebuilder.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/rebuilder.py b/rebuilder.py
index d4b46d33..c9a5a885 100644
--- a/rebuilder.py
+++ b/rebuilder.py
@@ -88,6 +88,7 @@ REDIRECT = {'arguments': 'Arguments',
'Repr': 'Backquote',
}
PY3K = sys.version_info >= (3, 0)
+PY34 = sys.version_info >= (3, 4)
def _init_set_doc(node, newnode):
newnode.doc = None
@@ -854,6 +855,13 @@ class TreeRebuilder3k(TreeRebuilder):
def visit_arguments(self, node, parent):
newnode = super(TreeRebuilder3k, self).visit_arguments(node, parent)
+ if PY34:
+ # change added in 82732 (7c5c678e4164), vararg and kwarg
+ # are instances of `_ast.arg`, not strings
+ if node.vararg:
+ newnode.vararg = node.vararg.arg
+ if node.kwarg:
+ newnode.kwarg = node.kwarg.arg
self.asscontext = "Ass"
newnode.kwonlyargs = [self.visit(child, newnode) for child in node.kwonlyargs]
self.asscontext = None