# HG changeset patch
# User Robert Bradshaw <robertwb@math.washington.edu>
# Date 1314767776 25200
# Node ID 8c8c6740b23f218520d3db550e2994ab1679807d
# Parent 2a2abbcad325ccca9399981ceddf5897eb467e64
#11761 - Upgrade to Cython 0.15
Most of these changes are due to the fact that Cython no longer initializes
all locals to None, rather using such a variable is an error as it is in
Python.
diff -r 2a2abbcad325 -r 8c8c6740b23f sage/coding/binary_code.pyx
a
|
b
|
|
1516 | 1516 | """ |
1517 | 1517 | def __cinit__(self, arg1, arg2=None): |
1518 | 1518 | cdef int k, nwords, ncols, sizeof_int |
1519 | | cdef PartitionStack other |
| 1519 | cdef PartitionStack other = None |
1520 | 1520 | cdef int *wd_ents, *wd_lvls, *col_ents, *col_lvls |
1521 | 1521 | cdef int *col_degs, *col_counts, *col_output, *wd_degs, *wd_counts, *wd_output |
1522 | 1522 | sizeof_int = sizeof(int) |
diff -r 2a2abbcad325 -r 8c8c6740b23f sage/libs/singular/function.pyx
a
|
b
|
|
1102 | 1102 | """ |
1103 | 1103 | from sage.matrix.matrix_mpolynomial_dense import Matrix_mpolynomial_dense |
1104 | 1104 | from sage.matrix.matrix_integer_dense import Matrix_integer_dense |
| 1105 | ring2 = None |
1105 | 1106 | for a in args: |
1106 | 1107 | if PY_TYPE_CHECK(a, MPolynomialIdeal): |
1107 | 1108 | ring2 = a.ring() |
diff -r 2a2abbcad325 -r 8c8c6740b23f sage/matrix/matrix_dense.pyx
a
|
b
|
|
397 | 397 | image.subdivide(*self.subdivisions()) |
398 | 398 | return image |
399 | 399 | |
400 | | def _derivative(self, var=None): |
| 400 | def _derivative(self, var=None, R=None): |
401 | 401 | """ |
402 | 402 | Differentiate with respect to var by differentiating each element |
403 | 403 | with respect to var. |
diff -r 2a2abbcad325 -r 8c8c6740b23f sage/matrix/matrix_double_dense.pyx
a
|
b
|
|
1960 | 1960 | """ |
1961 | 1961 | if algorithm not in ('pade', 'eig', 'taylor'): |
1962 | 1962 | raise ValueError("algorithm must be 'pade', 'eig', or 'taylor'") |
1963 | | |
| 1963 | |
| 1964 | global scipy |
1964 | 1965 | if scipy is None: |
1965 | 1966 | import scipy |
1966 | 1967 | import scipy.linalg |
diff -r 2a2abbcad325 -r 8c8c6740b23f sage/matrix/matrix_integer_dense.pyx
a
|
b
|
|
1659 | 1659 | |
1660 | 1660 | proof = get_proof_flag(proof, "linear_algebra") |
1661 | 1661 | pivots = None |
| 1662 | rank = None |
1662 | 1663 | |
1663 | 1664 | if algorithm == "padic": |
1664 | 1665 | import matrix_integer_dense_hnf |
diff -r 2a2abbcad325 -r 8c8c6740b23f sage/matrix/matrix_sparse.pyx
a
|
b
|
|
656 | 656 | m.subdivide(*self.subdivisions()) |
657 | 657 | return m |
658 | 658 | |
659 | | def _derivative(self, var=None): |
| 659 | def _derivative(self, var=None, R=None): |
660 | 660 | """ |
661 | 661 | Differentiate with respect to var by differentiating each element |
662 | 662 | with respect to var. |
diff -r 2a2abbcad325 -r 8c8c6740b23f sage/matrix/misc.pyx
a
|
b
|
|
327 | 327 | p = matrix_modn_sparse.MAX_MODULUS + 1 |
328 | 328 | else: |
329 | 329 | p = matrix_modn_dense.MAX_MODULUS + 1 |
| 330 | t = None |
330 | 331 | X = [] |
331 | 332 | best_pivots = [] |
332 | 333 | prod = 1 |
diff -r 2a2abbcad325 -r 8c8c6740b23f sage/misc/misc_c.pyx
a
|
b
|
|
42 | 42 | [101, 103, 106, 110, 115, 121, 128, 136, 145, 155] |
43 | 43 | """ |
44 | 44 | cdef bint first = 1 |
| 45 | running = None |
45 | 46 | for x in L: |
46 | 47 | if first: |
47 | 48 | total = L[0] if start is None else L[0]+start |
diff -r 2a2abbcad325 -r 8c8c6740b23f sage/plot/plot3d/base.pyx
a
|
b
|
|
906 | 906 | from shapes2 import frame3d, frame_labels |
907 | 907 | F = frame3d(xyz_min, xyz_max, opacity=0.5, color=(0,0,0), thickness=thickness) |
908 | 908 | if labels: |
909 | | F_text = frame_labels(xyz_min, xyz_max, a_min_orig, a_max_orig) |
910 | | |
911 | | X += F + F_text |
| 909 | F += frame_labels(xyz_min, xyz_max, a_min_orig, a_max_orig) |
| 910 | |
| 911 | X += F |
912 | 912 | |
913 | 913 | if axes: |
914 | 914 | # draw axes |
diff -r 2a2abbcad325 -r 8c8c6740b23f sage/rings/fraction_field_element.pyx
a
|
b
|
|
206 | 206 | pass |
207 | 207 | self.__numerator = num |
208 | 208 | self.__denominator = den |
209 | | except AttributeError, s: |
| 209 | except AttributeError: |
210 | 210 | raise ArithmeticError, "unable to reduce because lack of gcd or quo_rem algorithm" |
211 | | except TypeError, s: |
| 211 | except TypeError: |
212 | 212 | raise ArithmeticError, "unable to reduce because gcd algorithm doesn't work on input" |
213 | | except NotImplementedError, s: |
| 213 | except NotImplementedError: |
214 | 214 | raise ArithmeticError, "unable to reduce because gcd algorithm not implemented on input" |
215 | 215 | |
216 | 216 | def __copy__(self): |
diff -r 2a2abbcad325 -r 8c8c6740b23f sage/rings/integer.pyx
a
|
b
|
|
4107 | 4107 | # raise RuntimeError, "inconsistent results between GMP and pari" |
4108 | 4108 | #return g.isprime(flag=flag) |
4109 | 4109 | |
4110 | | def is_prime(self): |
| 4110 | def is_prime(self, proof=None): |
4111 | 4111 | r""" |
4112 | 4112 | Returns ``True`` if self is prime. |
4113 | 4113 | |
diff -r 2a2abbcad325 -r 8c8c6740b23f sage/rings/polynomial/pbori.pyx
a
|
b
|
|
625 | 625 | sage: I.groebner_basis() |
626 | 626 | [1] |
627 | 627 | """ |
| 628 | msg = None |
628 | 629 | cdef BooleanPolynomial p |
629 | 630 | # we check for other PolyBoRi types first since this conversion |
630 | 631 | # is used by the PolyBoRi python code often |
… |
… |
|
653 | 654 | p *= var_mapping[i] |
654 | 655 | return p |
655 | 656 | else: |
656 | | raise TypeError, "cannot coerce monomial %s to %s: %s"%(other,self,msg) |
| 657 | raise TypeError, "cannot coerce monomial %s to %s"%(other,self) |
657 | 658 | |
658 | 659 | elif PY_TYPE_CHECK(other,BooleanPolynomial) and \ |
659 | 660 | ((<BooleanPolynomialRing>(<BooleanPolynomial>other)\ |
… |
… |
|
749 | 750 | ... |
750 | 751 | TypeError: cannot convert polynomial z*x^2 + 5*y^3 to Boolean PolynomialRing in x, y: name z not defined |
751 | 752 | """ |
| 753 | msg = None |
752 | 754 | cdef int i |
753 | 755 | |
754 | 756 | try: |
… |
… |
|
1941 | 1943 | m*= var_mapping[i] |
1942 | 1944 | return m |
1943 | 1945 | else: |
1944 | | raise ValueError, "cannot convert polynomial %s to %s: %s"%(other,self,msg) |
| 1946 | raise ValueError, "cannot convert polynomial %s to %s"%(other,self) |
1945 | 1947 | |
1946 | 1948 | elif PY_TYPE_CHECK(other, BooleanMonomial) and \ |
1947 | 1949 | ((<BooleanMonomial>other)._pbmonom.deg() <= \ |
diff -r 2a2abbcad325 -r 8c8c6740b23f sage/rings/real_double.pyx
a
|
b
|
|
1674 | 1674 | return exponent.parent()(self) ** exponent # neither operand is RealDoubleElement |
1675 | 1675 | else: |
1676 | 1676 | try: |
1677 | | base = exp.parent()(self) |
| 1677 | base = exponent.parent()(self) |
1678 | 1678 | return base.__pow_float((<RealDoubleElement>exponent)._value) |
1679 | 1679 | except TypeError: |
1680 | 1680 | return self ** self.parent()(exponent) # neither operand is RealDoubleElement |
diff -r 2a2abbcad325 -r 8c8c6740b23f sage/rings/real_mpfi.pyx
a
|
b
|
|
999 | 999 | mpfi_set_fr(self.value, rn.value) |
1000 | 1000 | elif PY_TYPE_CHECK(x, Rational): |
1001 | 1001 | rat = x |
1002 | | mpfi_set_q(self.value, <mpq_t> rat.value) |
| 1002 | mpfi_set_q(self.value, rat.value) |
1003 | 1003 | elif PY_TYPE_CHECK(x, Integer): |
1004 | 1004 | integ = x |
1005 | | mpfi_set_z(self.value, <mpz_t> integ.value) |
| 1005 | mpfi_set_z(self.value, integ.value) |
1006 | 1006 | elif PY_TYPE_CHECK(x, int): |
1007 | 1007 | ix = x |
1008 | 1008 | mpfi_set_si(self.value, ix) |
diff -r 2a2abbcad325 -r 8c8c6740b23f sage/structure/coerce.pyx
a
|
b
|
|
514 | 514 | 2 |
515 | 515 | """ |
516 | 516 | self._exceptions_cleared = False |
| 517 | res = None |
517 | 518 | if not PY_TYPE_CHECK(xp, type) and not PY_TYPE_CHECK(xp, Parent): |
518 | 519 | xp = parent_c(xp) |
519 | 520 | if not PY_TYPE_CHECK(yp, type) and not PY_TYPE_CHECK(yp, Parent): |
… |
… |
|
710 | 711 | return (<Action>action)._call_(x, y) |
711 | 712 | |
712 | 713 | try: |
| 714 | xy = None |
713 | 715 | xy = self.canonical_coercion(x,y) |
714 | 716 | return PyObject_CallObject(op, xy) |
715 | 717 | except TypeError, err: |
diff -r 2a2abbcad325 -r 8c8c6740b23f sage/symbolic/expression.pyx
a
|
b
|
|
1956 | 1956 | falsify = operator.lt |
1957 | 1957 | cdef bint equality_ok = op in [equal, less_or_equal, greater_or_equal] |
1958 | 1958 | cdef int errors = 0 |
| 1959 | val = None |
1959 | 1960 | if len(vars) == 0: |
1960 | | val = None |
1961 | 1961 | try: |
1962 | 1962 | val = domain(diff) |
1963 | 1963 | except (TypeError, ValueError, ArithmeticError), ex: |
… |
… |
|
2563 | 2563 | sage: x^oo |
2564 | 2564 | Traceback (most recent call last): |
2565 | 2565 | ... |
2566 | | RuntimeError: power::eval(): pow(x, Infinity) for non numeric x is not defined. |
| 2566 | ValueError: power::eval(): pow(x, Infinity) for non numeric x is not defined. |
2567 | 2567 | sage: SR(oo)^2 |
2568 | 2568 | +Infinity |
2569 | 2569 | sage: SR(-oo)^2 |
… |
… |
|
3453 | 3453 | sage: (x^y).subs(x=oo) |
3454 | 3454 | Traceback (most recent call last): |
3455 | 3455 | ... |
3456 | | RuntimeError: power::eval(): pow(Infinity, x) for non numeric x is not defined. |
| 3456 | ValueError: power::eval(): pow(Infinity, x) for non numeric x is not defined. |
3457 | 3457 | sage: (x^y).subs(y=oo) |
3458 | 3458 | Traceback (most recent call last): |
3459 | 3459 | ... |
3460 | | RuntimeError: power::eval(): pow(x, Infinity) for non numeric x is not defined. |
| 3460 | ValueError: power::eval(): pow(x, Infinity) for non numeric x is not defined. |
3461 | 3461 | sage: (x+y).subs(x=oo) |
3462 | 3462 | +Infinity |
3463 | 3463 | sage: (x-y).subs(y=oo) |
diff -r 2a2abbcad325 -r 8c8c6740b23f setup.py
a
|
b
|
|
805 | 805 | cplus = '' |
806 | 806 | |
807 | 807 | # call cython, abort if it failed |
808 | | cmd = "python `which cython` %s --disable-function-redefinition --embed-positions --directive cdivision=True,autotestdict=False,fast_getattr=True -I%s -o %s %s"%(cplus, os.getcwd(), outfile, f) |
| 808 | cmd = "python `which cython` %s --old-style-globals --disable-function-redefinition --embed-positions --directive cdivision=True,autotestdict=False,fast_getattr=True -I%s -o %s %s"%(cplus, os.getcwd(), outfile, f) |
809 | 809 | r = run_command(cmd) |
810 | 810 | if r: |
811 | 811 | return r |