diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2013-08-13 13:48:51 +0300 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2013-08-13 13:48:51 +0300 |
commit | 1100458bb85aadbf49ad5c08ec43f75995bac1f5 (patch) | |
tree | 0de68d2bca3200decc03fab3706f7e1f59288925 /scoped_nodes.py | |
parent | 0b9211efae4ca1b29559a81ae82aed6f0a42d262 (diff) | |
download | astroid-git-1100458bb85aadbf49ad5c08ec43f75995bac1f5.tar.gz |
Change metaclass discovery.
--HG--
branch : metaclass
Diffstat (limited to 'scoped_nodes.py')
-rw-r--r-- | scoped_nodes.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/scoped_nodes.py b/scoped_nodes.py index 3f6e55a5..939fc74b 100644 --- a/scoped_nodes.py +++ b/scoped_nodes.py @@ -992,18 +992,23 @@ class Class(Statement, LocalsDictNodeNG, FilterStmtsMixin): raise InferenceError() _metaclass = None - def metaclass(self): - """ return the metaclass of this class """ + def _metaclass_search(self): + """ Return the metaclass of this class """ if self._metaclass: - return self._metaclass + # Expects this from Py3k TreeRebuilder + try: + return self._metaclass.infered()[0] + except InferenceError: + return try: - meta = Instance(self).getattr('__metaclass__')[0] + meta = self.getattr('__metaclass__')[0] except NotFoundError: return - - # XXX: We could return the actual class instance, not the string - # representing its name, but I don't know how to handle this - # with Py3's metaclass keyword.. - return meta.infered()[0].name -
\ No newline at end of file + try: + infered = meta.infered()[0] + except InferenceError: + return + if infered is YES: # don't expose this + return None + return infered |