[Cython] calling gmp automatically

Ondrej Certik ondrej at certik.cz
Tue Dec 23 14:58:03 CET 2008


> cdef class mpz:
>    cdef __cinit__(...)
>        pass
>    cdef inline __add__(a, b):
>        cdef mpz tmp
>        mpz_add(a.thisptr, b.thisptr, tmp)
>        return tmp

^^ this should be:

        cdef mpz_t tmp
        mpz_init(tmp)
        mpz_add(a.thisptr, b.thisptr, tmp)
        return mpz(tmp)


Ondrej


More information about the Cython-dev mailing list