This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gmt
Recipients gmt
Date 2014-12-02.08:07:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1417507679.4.0.154391428418.issue22968@psf.upfronthosting.co.za>
In-reply-to
Content
Also:

In types.prepare_class, here is what currently happens:

we let x be, in order of preference:
  (a) the explicitly given type if, one is given, else
  (b) type(bases[0]), if it exists, else
  (c) type

and then, if isinstance(x, type), we run _calculate_bases.

In python 2, I think something like this really does happen, although, perhaps "isinstance(x, type)" should have been "issubclass(x, type)" to correctly capture how python 2 does it.

In particular, I think we can stick a Callable in there as bases[0], and then any old crazy list of objects as base classes, and it will call our Callable, although if we don't do something about our crazy base classes, it will still break later (something like that... I don't remember exactly, except that the first base is definitely special somehow).

But in python 3, if I'm reading the C code correctly, I don't think the first base class receives any "special" handling, and the cpython-equivalent to _calculate_bases /always/ happens, suggesting that any non-descending-from-type metaclass is expected to have removed itself from the picture before type_new is invoked.

So maybe more minor re-factoring is needed to get it all straightened out.  My brain is kind of fried from looking at it, I'll try again later.
History
Date User Action Args
2014-12-02 08:07:59gmtsetrecipients: + gmt
2014-12-02 08:07:59gmtsetmessageid: <1417507679.4.0.154391428418.issue22968@psf.upfronthosting.co.za>
2014-12-02 08:07:59gmtlinkissue22968 messages
2014-12-02 08:07:58gmtcreate