[Pyrex] Pyrex doesn't seem to recognize param type.
tarkawebfoot at charter.net
tarkawebfoot at charter.net
Thu Feb 23 21:45:40 CET 2006
Hi all,
I'm trying to wrap the decNumber library with Pyrex and have had pretty good success so far. There's only one last problem showing up.
I have an extension class defined like this:
cdef class oetl_decimal:
.
.
.
cdef void set_buffer(self, decNumber *buffer):
if buffer[0].digits > self.context.ctx.digits:
raise InvalidOperation("Context precision is too low to set buffer.")
decNumberRescale(self.buffer, buffer, self.context.decScale, &self.context.ctx)
self.context.c_assert()
.
.
.
def normalized(self):
cdef decNumber *tmp
tmp = <decNumber *> alloca(128)
decNumberNormalize(tmp, self.buffer, &self.context.ctx)
self.context.c_assert()
res = oetl_decimal(self.context)
res.set_buffer(tmp)
return res
When I compile, Pyrex complains in the call to res.set_buffer(tmp) above that it can't convert a decNumber (*) to a python object. But tmp is cdef'ed as a decNumber * and set_buffer is cdef'ed to accept a decNumber * as its second parameter.
Am I doing something stupid and obvious here? I've tried a couple of things, including looking at the generated code (which looks OK to me), and discovered that Pyrex seems to know tmp is a decNumber *. It doesn't seem to realize the set_buffer's second argument is a decNumber *.
Any help appreciated
Brian
More information about the Pyrex
mailing list