[Pyrex] int operations on enums fail with 0.9.5
Stefan Behnel
stefan_ml at behnel.de
Tue Feb 13 22:41:44 UTC 2007
Hi,
Greg Ewing schrieb:
> Stefan Behnel wrote:
>> in lxml, we use a couple of enums from libxml2 ...
>> However, the | and & operations produce "invalid operand types" errors
>
> That's a bug -- I'll fix it in the next release.
Ok, here's a work-around for now, for those who need it.
Have fun,
Stefan
@@ -2322,6 +2349,10 @@
def analyse_c_operation(self, env):
type1 = self.operand1.type
type2 = self.operand2.type
+ if type1.is_enum:
+ type1 = PyrexTypes.c_int_type
+ if type2.is_enum:
+ type2 = PyrexTypes.c_int_type
self.type = self.compute_c_result_type(type1, type2)
if not self.type:
self.type_error()
More information about the Pyrex
mailing list