summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2014-04-30 11:53:32 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2014-04-30 11:53:32 +0300
commitb13ef13e8365348b957e77105fdeeeb5bde69c49 (patch)
tree347c3787720a209cc11cd386e7bec9bed45c4bfe
parenta5b123645d89cd660bd56eebc07f627cd7134588 (diff)
parentf1ed6e4d50b3e3fef31a214f534b2611fe1f141d (diff)
downloadastroid-git-b13ef13e8365348b957e77105fdeeeb5bde69c49.tar.gz
Merge with ancestors.
-rw-r--r--scoped_nodes.py10
-rw-r--r--test/unittest_python3.py1
-rw-r--r--test/unittest_scoped_nodes.py1
3 files changed, 6 insertions, 6 deletions
diff --git a/scoped_nodes.py b/scoped_nodes.py
index 067f01fd..20bb664f 100644
--- a/scoped_nodes.py
+++ b/scoped_nodes.py
@@ -1055,12 +1055,10 @@ class Class(Statement, LocalsDictNodeNG, FilterStmtsMixin):
if self._metaclass:
# Expects this from Py3k TreeRebuilder
try:
- infered = next(self._metaclass.infer())
- except InferenceError:
- return
- if infered is YES: # don't expose it
- return None
- return infered
+ return next(node for node in self._metaclass.infer()
+ if node is not YES)
+ except (InferenceError, StopIteration):
+ return
try:
meta = self.getattr('__metaclass__')[0]
diff --git a/test/unittest_python3.py b/test/unittest_python3.py
index 9e804068..114e3d37 100644
--- a/test/unittest_python3.py
+++ b/test/unittest_python3.py
@@ -133,6 +133,7 @@ class Python3TC(TestCase):
@require_version('3.0')
def test_metaclass_yes_leak(self):
astroid = self.builder.string_build(dedent("""
+ # notice `ab` instead of `abc`
from ab import ABCMeta
class Meta(metaclass=ABCMeta): pass
diff --git a/test/unittest_scoped_nodes.py b/test/unittest_scoped_nodes.py
index 3d053189..6c56c55f 100644
--- a/test/unittest_scoped_nodes.py
+++ b/test/unittest_scoped_nodes.py
@@ -718,6 +718,7 @@ def g2():
def test_metaclass_yes_leak(self):
astroid = abuilder.string_build(dedent("""
+ # notice `ab` instead of `abc`
from ab import ABCMeta
class Meta(object):