Message134256
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. |
|
Date |
User |
Action |
Args |
2011-04-21 22:35:35 | daniel.urban | set | recipients:
+ daniel.urban, gvanrossum, georg.brandl, terry.reedy, amaury.forgeotdarc, ncoghlan, rodsenra, pwerneck, benjamin.peterson |
2011-04-21 22:35:35 | daniel.urban | set | messageid: <1303425335.3.0.887930178781.issue1294232@psf.upfronthosting.co.za> |
2011-04-21 22:35:34 | daniel.urban | link | issue1294232 messages |
2011-04-21 22:35:34 | daniel.urban | create | |
|