Daniel Urban <[email protected]> added the comment:
I've just realized, that my patch still breaks a case, that previously worked:
when the bases are not classes.
This works in 3.2, but not with my patch:
>>> class Foo: # not a subclass of type!
... def __new__(mcls, name='foo', bases=(), namespace={}):
... self = super().__new__(mcls)
... self.name = name
... return self
...
>>> foo1 = Foo('foo1')
>>> foo1.name
'foo1'
>>>
>>> foo2 = Foo('foo2')
>>> foo2.name
'foo2'
>>>
>>> class foo3(foo1, foo2):pass
...
>>> foo3
<__main__.Foo object at 0xb74aa96c>
>>> foo3.name
'foo3'
This raises a TypeError: "metaclass conflict: the metaclass of a derived class
must be a (non-strict) subclass of the metaclasses of all its bases". In this
case the *type* of all of its bases is the same (Foo), but that type is not a
metaclass, but a regular class.
Right now I don't know if this is a real problem, or how to solve it.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue1294232>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com