[Pyrex] Pyrex can't handle enum values as exception values

Stefan Behnel behnel_ml at gkec.informatik.tu-darmstadt.de
Sat May 20 12:00:36 CEST 2006


Hi,

I tried to declare an enum value as exception return value like this:

cdef fromh.myEnum myfunc(bla) except fromh.MY_ENUM_VALUE:
  ...

This lets Pyrex complain: "Exception value must be an int or float literal or
NULL". I don't think enums should be excluded here as they commonly qualify as
'int' everywhere in C.

The problem here is that it's not me defining that enum, so using the literal
int value would let my code break in the (admittedly unlikely) case that the
enum declaration ever changes.

Stefan



More information about the Pyrex mailing list