[issue22968] types._calculate_meta nit: isinstance != PyType_IsSubtype
Greg Turner
report at bugs.python.org
Sat Nov 29 21:38:34 CET 2014
New submission from Greg Turner:
Kinda trivial but...
Something like the enclosed, untested patch would seem to make new_class work a bit more like type_new.
To be explicit, the difference is whether or not to respect virtual subclasses.
So, for example, as implemented, we can implement __subclasscheck__ on a 'AtypicalMeta' metaclass to create an 'Atypical' class whose __mro__ is (ATypical, object) -- note, no 'type' -- but for which issubclass(type, ATypical) is true.
If I'm not mistaken, this disguise will suffice sneak our psuedo-metatype past new_class (but not type.__new__, so we still get the same error message, and the universe does not implode on itself as planned...)
In my case,the only sequela was that the fantasy of my very own type-orthogonal graph of "foo"-style classes in 3.x was first subtly encouraged and then dashed against the Cpython rocks... (just kidding, sort-of).
----------
components: Library (Lib)
files: fix_types_calculate_meta.patch
keywords: patch
messages: 231871
nosy: gmt
priority: normal
severity: normal
status: open
title: types._calculate_meta nit: isinstance != PyType_IsSubtype
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file37318/fix_types_calculate_meta.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22968>
_______________________________________
More information about the Python-bugs-list
mailing list