sagemath/14452_cython_0.19.patch
2013-04-22 17:38:06 -03:00

120 lines
4.1 KiB
Diff

# HG changeset patch
# User Jeroen Demeyer <jdemeyer@cage.ugent.be>
# Date 1366033527 -7200
# Node ID 3eaa1319e9e3bb9d65043524bd1fe6ada6242b8e
# Parent 6bafbfc4bdfe76b564e595f790902dda4c0df4c5
Upgrade Cython to 0.19
diff --git a/module_list.py b/module_list.py
--- a/module_list.py
+++ b/module_list.py
@@ -1867,8 +1867,12 @@
Extension('sage.structure.coerce_maps',
sources = ['sage/structure/coerce_maps.pyx']),
+ # Compile this with -Os because it works around a bug with
+ # GCC-4.7.3 + Cython 0.19 on Itanium, see Trac #14452. Moreover, it
+ # actually results in faster code than -O3.
Extension('sage.structure.element',
- sources = ['sage/structure/element.pyx']),
+ sources = ['sage/structure/element.pyx'],
+ extra_compile_args=["-Os"]),
Extension('sage.structure.factory',
sources = ['sage/structure/factory.pyx']),
diff --git a/sage/ext/cdefs.pxi b/sage/ext/cdefs.pxi
--- a/sage/ext/cdefs.pxi
+++ b/sage/ext/cdefs.pxi
@@ -7,13 +7,6 @@
from libc.stdio cimport *
from libc.string cimport strlen, strcpy, memset, memcpy
-from libc.math cimport sqrt
-# Cython misdeclares these: http://trac.cython.org/cython_trac/ticket/801
-cdef extern from "<math.h>":
- double frexp(double x, int* exponent)
- double ldexp(double x, int exponent)
-
+from libc.math cimport sqrt, frexp, ldexp
from sage.libs.gmp.all cimport *
-cdef extern from "<gmp.h>":
- pass # Cython bug sometimes includes this in the wrong place
diff --git a/sage/ext/gen_interpreters.py b/sage/ext/gen_interpreters.py
--- a/sage/ext/gen_interpreters.py
+++ b/sage/ext/gen_interpreters.py
@@ -2474,8 +2474,8 @@
}
"""
self.pxd_header = """
-# This is to work around a header ordering bug in Cython < 0.11
-# (Pari is included from sage.rings.complex_double.)
+# This is to work around a header incompatibility with PARI using
+# "I" as variable conflicting with the complex "I".
cdef extern from "pari/paricfg.h":
pass
cdef extern from "pari/pari.h":
diff --git a/sage/graphs/graph_decompositions/rankwidth.pyx b/sage/graphs/graph_decompositions/rankwidth.pyx
--- a/sage/graphs/graph_decompositions/rankwidth.pyx
+++ b/sage/graphs/graph_decompositions/rankwidth.pyx
@@ -205,7 +205,7 @@
# Actual computation
calculate_level(i)
- _sig_off
+ sig_off()
cdef int rank_width = <int> get_rw()
diff --git a/sage/misc/lazy_import.pyx b/sage/misc/lazy_import.pyx
--- a/sage/misc/lazy_import.pyx
+++ b/sage/misc/lazy_import.pyx
@@ -36,8 +36,7 @@
# http://www.gnu.org/licenses/
#*****************************************************************************
-cdef extern from *:
- cdef int Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE
+from cpython.object cimport Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE
import os, shutil, tempfile, cPickle as pickle, operator
import inspect
@@ -91,7 +90,9 @@
self._as_name = as_name
self._namespace = namespace
- cpdef _get_object(self, owner=None):
+ # Due to a bug in Cython-0.19, this must not be a cpdef method.
+ # See http://trac.sagemath.org/sage_trac/ticket/14452
+ def _get_object(self, owner=None):
"""
Return the wrapped object, importing it if necessary.
diff --git a/sage/modular/arithgroup/farey_symbol.pyx b/sage/modular/arithgroup/farey_symbol.pyx
--- a/sage/modular/arithgroup/farey_symbol.pyx
+++ b/sage/modular/arithgroup/farey_symbol.pyx
@@ -564,12 +564,3 @@
c = convert_to_Integer(M.c())
d = convert_to_Integer(M.d())
return SL2Z([a, b, c, d])
-
-# Use them to work around Cython bug forcing the unused
-# declarations to be emitted.
-cdef void _use_conversions():
- &convert_to_long
- &convert_to_Integer
- &convert_to_rational
- &convert_to_cusp
- &convert_to_SL2Z
diff --git a/sage/numerical/backends/ppl_backend.pyx b/sage/numerical/backends/ppl_backend.pyx
--- a/sage/numerical/backends/ppl_backend.pyx
+++ b/sage/numerical/backends/ppl_backend.pyx
@@ -612,7 +612,7 @@
"""
if name == NULL:
return self.name
- self.name = <str>name
+ self.name = str(<bytes>name)
cpdef row(self, int i):
"""