[IronPython] tuple subclass and super()

hardcoded.software at gmail.com hardcoded.software at gmail.com
Wed Sep 27 15:43:00 CEST 2006


I am evaluating whether it is possible for me to jump into the
IronPython bandwagon by running my test units through ipy, but I have a
big problem with one of my classes, which is a subclass of tuple. I
will not post my whole class here, but a re-creation of the problem:

class Foobar(tuple):
    def __new__(cls,value):
        if isinstance(value,Foobar):
            return value
        return tuple.__new__(cls,value)

    def __eq__(self,other):
        other = Foobar(other)
        return super(Foobar,self).__eq__(other)

foobar = Foobar('foo')
print foobar == 'foo'

(It might look silly, but it is actually useful for me to do that.)
Under CPython, it works (True is printed), but with IPY, I get an
access violation (caused by a stack overflow I think).

More information about the Ironpython-users mailing list