Closed abodelot closed 12 years ago
Thanks. This was fixed in commit 78743d8c8cf5de18e1057b0abbbeb0c2d3f0b7e3, and in source release 0.1.1. The installers on this page should include the change: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pysfml2.
The problem was that Cython lets you define a special __cinit__
method that will always automatically get called with the arguments passed to the child class' constructor. So as you said, it gets called before your own constructor with invalid arguments and raised an exception. I replaced it with a normal __init__
constructor.
Oh, sorry for the false flag. I'll make sure I'm up to date for the next time!
When inheriting sf.Sprite, the sub-class cannot be initialized if the constructor is invoked with an argument. The code bellow reproduces the bug:
A TypeError exception is raised:
The line
print "Entity.__init__ called"
is not executed, I assumeEntity.__init__
is bypassed andsf.Sprite.__init__
is directly called instead.By removing the argument in the last line (replacing
Entity(5)
withEntity()
), the code runs correctly and entersEntity.__init__
as expected.Environment: Windows XP / Python 2.7 / pySFML-0.1.win32-py2.7 (installer)