Hi!
For fun, I have been implementing a Python binding to GMP. I have a class like
this:
cdef class GMPInt:
cdef mpz_t ob_val
....
def __add__(self, GMPInt other):
cdef mpz_t temp
mpz_init(temp)
mpz_add(temp, self.ob_val, other.ob_val)
mpz_clear(temp)
....
When I try to compile it I get this error:
mpz_add(temp, self.ob_val, other.ob_val)
^
------------------------------------------------------------
/temp/sandbox/pygmp/src/_gmp.pyx:49:27: Cannot convert Python object to 'mpz_t'
It compiles correctly when I define a declaration for self in __add__
like this, though:
def __add__(GMPInt self, GMPInt other)
I thought type declarations were supposed to be implicit on self in
classes. Is this just an anomaly?
I have Cython 0.10.
Thanks for the help!
--
Cheers,
Benjamin Peterson
"There's nothing quite as beautiful as an oboe... except a chicken
stuck in a vacuum cleaner."
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev