PythonCharmers/python-future

metaclass conflict with newstr

Open

#392 opened on Oct 16, 2018

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Python (327 forks)batch import
0.20help wanted

Repository metrics

Stars
 (1,172 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Same issue as #91 except with newstr

from future.builtins import str
from future.utils import with_metaclass

class MetaClass(type):
    pass

class TestClass(with_metaclass(MetaClass, str)):
    pass

output:

Traceback (most recent call last):
  File "foo.py", line 7, in <module>
    class TestClass(with_metaclass(MetaClass, str)):
  File "/usr/local/lib/python2.7/site-packages/future/utils/__init__.py", line 137, in __new__
    return meta(name, bases, d)
TypeError: Error when calling the metaclass bases
    metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

Contributor guide