summaryrefslogtreecommitdiff
path: root/rebuilder.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2013-07-24 19:00:09 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2013-07-24 19:00:09 +0300
commite556fa2424be3df11c92a18548ea868004e8adb8 (patch)
tree455dcae463821ebef730bfa2e89cfcddbd03be0c /rebuilder.py
parent11852fba151b9d1bff2f262be743925052a91ddd (diff)
downloadastroid-git-e556fa2424be3df11c92a18548ea868004e8adb8.tar.gz
Proper metaclass handling.
Diffstat (limited to 'rebuilder.py')
-rw-r--r--rebuilder.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/rebuilder.py b/rebuilder.py
index fbc7ba8a..9261ff63 100644
--- a/rebuilder.py
+++ b/rebuilder.py
@@ -250,9 +250,8 @@ class TreeRebuilder(object):
meth.extra_decorators.append(newnode.value)
except (AttributeError, KeyError):
continue
- elif getattr(newnode.targets[0], 'name', None) == '__metaclass__':
- # XXX check more...
- self._metaclass[-1] = 'type' # XXX get the actual metaclass
+ elif getattr(node.targets[0], 'id', None) == '__metaclass__':
+ self._metaclass[-1] = _infer_metaclass(node.value) or 'type'
newnode.set_line_info(newnode.last_child())
return newnode
@@ -945,7 +944,7 @@ class TreeRebuilder3k(TreeRebuilder):
newnode = super(TreeRebuilder3k, self).visit_class(node, parent)
for keyword in node.keywords:
if keyword.arg == 'metaclass':
- newnode._metaclass = _infer_metaclass(keyword.value)
+ newnode._metaclass = _infer_metaclass(keyword.value) or 'type'
break
return newnode