id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
11680 support extra_compile_args (e.g., C99) when loading/attaching .pyx (cython) files, and when using %cython in the notebook was jason "Right now, the following file `foo.pyx` cannot be just loaded into Sage:
{{{
from sage.rings.rational cimport Rational
from sage.rings.polynomial.polynomial_rational_flint cimport Polynomial_rational_flint
from sage.libs.flint.fmpq_poly cimport (fmpq_poly_get_coeff_mpq, fmpq_poly_set_coeff_mpq,
fmpq_poly_length)
def evaluate_at_power_of_gen(Polynomial_rational_flint f, unsigned long n):
assert n >= 1
cdef Polynomial_rational_flint res = f._new()
cdef unsigned long k
cdef Rational z = Rational(0)
for k in range(fmpq_poly_length(f.__poly)):
fmpq_poly_get_coeff_mpq(z.value, f.__poly, k)
fmpq_poly_set_coeff_mpq(res.__poly, n*k, z.value)
return res
}}}
The main reason is that there is no way to tell Sage (i.e., the file `cython.py`) that the code needs to have the extra compile flag:
{{{
extra_compile_args = ['-std=c99'],
}}}
Currently `devel/sage/sage/misc/cython.py` supports ""clang"", ""clib"", and ""cinclude"" pragmas. But none of these let us add an `extra_compile_arg` or use C99.
----
Apply [attachment:trac_11680.patch] to the Sage library.
" enhancement closed minor sage-4.7.2 misc fixed sd32 robertwb sage-4.7.2.alpha3 Martin Albrecht William Stein, Leif Leonhardy N/A