PythonCharmers/python-future

metaclass conflict with newstr

Open

#392 aperta il 16 ott 2018

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)Python (327 fork)batch import
0.20help wanted

Metriche repository

Star
 (1172 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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

Guida contributor