[Stackless] Stackless crash
Jeff Senn
senn at maya.com
Wed Sep 27 19:57:48 CEST 2006
---snip---
class a(str): __slots__ = ('b',)
a("foo")
---snip---
is an error in "regular" Python:
TypeError: Error when calling the metaclass bases
nonempty __slots__ not supported for subtype of 'str'
But Stackless unfortunately allows it and the resulting
class causes a crash when instances are generated.
The culprit is this line in typeobject.c:
#ifdef STACKLESS
if (nslots > 0 && base->tp_itemsize != 0 && !PyType_Check(base)) {
/* for the special case of meta types, allow slots */
#else
if (nslots > 0 && base->tp_itemsize != 0) {
#endif
I'm not sure what to do about this in general... I think the check is
just
wrong, but I'm not sure what the intent was in the first place... This
check should be conservative and only allow __slots__ on types that
are known
to be "slot compatible"...
-Jas
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless
More information about the Stackless
mailing list