PythonCharmers/python-future

metaclass conflict with newstr

Open

#392 创建于 2018年10月16日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)Python (327 fork)batch import
0.20help wanted

仓库指标

Star
 (1,172 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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

贡献者指南