I've encountered some behavior that I don't quite understand in Cython pure Python mode. I've got three classes, Foo, Bar and Baz. Both Bar and Baz inherit from Foo. All three implement the empty method quux(). (The problem also occurs if Bar inherits this from Foo -- but *not* if Baz does.)
The .pxd file looks like this: > cdef class Foo: > > cpdef quux(self) > > cdef class Bar(Foo): > > cpdef quux(self) > > cdef class Baz(Foo): > > cpdef quux(self) Now, I compile this, and try the following: > >>> bar = Bar() > >>> bar.quux() > Traceback (most recent call last): > ... > TypeError: Cannot convert some.path.Bar to some.path.Baz For some reason, there's a type check on the self argument, requiring it to be of the Baz class, even though the method is in the Bar class... This works when there are several classes involved, too. At first, I thought it consistently chose the last class in the pxd file (so it seemed in my real repo), but when I copied all the files to a new directory to try to construct a minimal example, it consistently (before I started whittling away) used the *next to last* class. The only difference was the path to the current directory... Is this a bug, or am I doing something wrong here? (If anyone's interested, I've got a tarball with a makefile ready to demonstrate the behavior.) -- Magnus Lie Hetland http://hetland.org _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
