diff options
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 |