[Pyrex] #if
Bryan Weingarten
bryan.weingarten at pobox.com
Wed Oct 22 02:31:24 CEST 2003
>In the code below, I've added an except * to the declaration of
>mpgedit_play_frame. Not sure if it will solve this problem,
>but it may help, because otherwise the while loop is likely
>to merrily loop on without ever checking for an exception.
>
>
>
>Saying "cdef class" is the Pyrex idiom for defining an extension type,
>which certainly can be called (i.e. instantiated) from Python. This is
>perhaps a bit inconsistent with other uses of "cdef", but I wanted to
>keep the number of new reserved words to a minimum.
>
>The following code passes the Pyrex compiler. I don't know whether
>it will pass the C compiler, since I don't have the header file.
>
>
>
>
>
greg,
thanks for your help. it compiled and ran, and the control-c even
worked, so exceptions are successfully bubbling up from the python code
through the callback and play_frame function. without the "except *"
after the play_frame the exception won't come though. i was unaware
that you could add except after a c function prototype. i thought it
could only be after a cdef function.
i am getting a bunch of __pyx_L? unreferenced label warnings. i take
it i shouldn't be worried about these. will they be cleaned up in
future versions of pyrex?
i don't know when to use a "class" and when to use a "cdef class" . i
know the former creates a python class and other one creates an
extension type. but what criteria should i consider to use each one.
i didn't change a line of code in my test program, but i was able to
successfully excercise mpgedit_play as a class and as as cdef class.
thanks,
bryan
More information about the Pyrex
mailing list