0
我遇到一些麻煩,這一段代碼用Cython 2.0下運行:遞歸限制超出與用Cython CDEF類和超
cdef class Foo(object):
cpdef twerk(self): #using def instead does not help
print "Bustin' some awkward moves."
cdef class ShyFoo(Foo):
cpdef twerk(self):
print "Do I really have to?"
super(self, ShyFoo).twerk()
print "I hate you so much."
ShyFoo().twerk()
RuntimeError: maximum recursion depth exceeded while calling a Python object
但是,刪除cdef
S和與def
小號取代cpdef
小號讓我工作Python。
回溯看起來是這樣的:
File "mytest.pyx", line 61, in mytest.Foo.twerk
cpdef twerk(self):
File "mytest.pyx", line 67, in mytest.ShyFoo.twerk
super(ShyFoo, self).twerk()
File "mytest.pyx", line 61, in mytest.Foo.twerk
cpdef twerk(self):
File "mytest.pyx", line 67, in mytest.ShyFoo.twerk
super(ShyFoo, self).twerk()
....................................................
我在做什麼錯?我在4年前發現了this relevant ticket,但是我猜這是因爲用戶錯誤而沒有引起注意。