[Stackless] Stackless crash

Jeff Senn senn at maya.com
Wed Sep 27 19:57:48 CEST 2006

class a(str): __slots__ = ('b',)

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:

		if (nslots > 0 && base->tp_itemsize != 0 && !PyType_Check(base)) {
			/* for the special case of meta types, allow slots */
		if (nslots > 0 && base->tp_itemsize != 0) {

I'm not sure what to do about this in general... I think the check is  
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"...


Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list