Ticket #11761: 11761-cython-0.15.patch

File 11761-cython-0.15.patch, 11.8 KB (added by robertwb, 10 years ago)
  • sage/coding/binary_code.pyx

    # 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  
    15161516    """
    15171517    def __cinit__(self, arg1, arg2=None):
    15181518        cdef int k, nwords, ncols, sizeof_int
    1519         cdef PartitionStack other
     1519        cdef PartitionStack other = None
    15201520        cdef int *wd_ents, *wd_lvls, *col_ents, *col_lvls
    15211521        cdef int *col_degs, *col_counts, *col_output, *wd_degs, *wd_counts, *wd_output
    15221522        sizeof_int = sizeof(int)
  • sage/libs/singular/function.pyx

    diff -r 2a2abbcad325 -r 8c8c6740b23f sage/libs/singular/function.pyx
    a b  
    11021102        """
    11031103        from  sage.matrix.matrix_mpolynomial_dense import Matrix_mpolynomial_dense
    11041104        from sage.matrix.matrix_integer_dense import Matrix_integer_dense
     1105        ring2 = None
    11051106        for a in args:
    11061107            if PY_TYPE_CHECK(a, MPolynomialIdeal):
    11071108                ring2 = a.ring()
  • sage/matrix/matrix_dense.pyx

    diff -r 2a2abbcad325 -r 8c8c6740b23f sage/matrix/matrix_dense.pyx
    a b  
    397397            image.subdivide(*self.subdivisions())
    398398        return image
    399399
    400     def _derivative(self, var=None):
     400    def _derivative(self, var=None, R=None):
    401401        """
    402402        Differentiate with respect to var by differentiating each element
    403403        with respect to var.
  • sage/matrix/matrix_double_dense.pyx

    diff -r 2a2abbcad325 -r 8c8c6740b23f sage/matrix/matrix_double_dense.pyx
    a b  
    19601960        """
    19611961        if algorithm not in ('pade', 'eig', 'taylor'):
    19621962            raise ValueError("algorithm must be 'pade', 'eig', or 'taylor'")
    1963            
     1963
     1964        global scipy
    19641965        if scipy is None:
    19651966            import scipy
    19661967        import scipy.linalg
  • sage/matrix/matrix_integer_dense.pyx

    diff -r 2a2abbcad325 -r 8c8c6740b23f sage/matrix/matrix_integer_dense.pyx
    a b  
    16591659
    16601660        proof = get_proof_flag(proof, "linear_algebra")
    16611661        pivots = None
     1662        rank = None
    16621663
    16631664        if algorithm == "padic":
    16641665            import matrix_integer_dense_hnf
  • sage/matrix/matrix_sparse.pyx

    diff -r 2a2abbcad325 -r 8c8c6740b23f sage/matrix/matrix_sparse.pyx
    a b  
    656656            m.subdivide(*self.subdivisions())
    657657        return m
    658658
    659     def _derivative(self, var=None):
     659    def _derivative(self, var=None, R=None):
    660660        """
    661661        Differentiate with respect to var by differentiating each element
    662662        with respect to var.
  • sage/matrix/misc.pyx

    diff -r 2a2abbcad325 -r 8c8c6740b23f sage/matrix/misc.pyx
    a b  
    327327        p = matrix_modn_sparse.MAX_MODULUS + 1
    328328    else:
    329329        p = matrix_modn_dense.MAX_MODULUS + 1
     330    t = None
    330331    X = []
    331332    best_pivots = []       
    332333    prod = 1
  • sage/misc/misc_c.pyx

    diff -r 2a2abbcad325 -r 8c8c6740b23f sage/misc/misc_c.pyx
    a b  
    4242        [101, 103, 106, 110, 115, 121, 128, 136, 145, 155]
    4343    """
    4444    cdef bint first = 1
     45    running = None
    4546    for x in L:
    4647        if first:
    4748            total = L[0] if start is None else L[0]+start
  • sage/plot/plot3d/base.pyx

    diff -r 2a2abbcad325 -r 8c8c6740b23f sage/plot/plot3d/base.pyx
    a b  
    906906            from shapes2 import frame3d, frame_labels
    907907            F = frame3d(xyz_min, xyz_max, opacity=0.5, color=(0,0,0), thickness=thickness)
    908908            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
    912912
    913913        if axes:
    914914            # draw axes
  • sage/rings/fraction_field_element.pyx

    diff -r 2a2abbcad325 -r 8c8c6740b23f sage/rings/fraction_field_element.pyx
    a b  
    206206                    pass
    207207            self.__numerator   = num
    208208            self.__denominator = den
    209         except AttributeError, s:
     209        except AttributeError:
    210210            raise ArithmeticError, "unable to reduce because lack of gcd or quo_rem algorithm"
    211         except TypeError, s:
     211        except TypeError:
    212212            raise ArithmeticError, "unable to reduce because gcd algorithm doesn't work on input"
    213         except NotImplementedError, s:
     213        except NotImplementedError:
    214214            raise ArithmeticError, "unable to reduce because gcd algorithm not implemented on input"           
    215215
    216216    def __copy__(self):
  • sage/rings/integer.pyx

    diff -r 2a2abbcad325 -r 8c8c6740b23f sage/rings/integer.pyx
    a b  
    41074107        #    raise RuntimeError, "inconsistent results between GMP and pari"
    41084108        #return g.isprime(flag=flag)
    41094109
    4110     def is_prime(self):
     4110    def is_prime(self, proof=None):
    41114111        r"""
    41124112        Returns ``True`` if self is prime.
    41134113       
  • sage/rings/polynomial/pbori.pyx

    diff -r 2a2abbcad325 -r 8c8c6740b23f sage/rings/polynomial/pbori.pyx
    a b  
    625625            sage: I.groebner_basis()
    626626            [1]
    627627        """
     628        msg = None
    628629        cdef BooleanPolynomial p
    629630        # we check for other PolyBoRi types first since this conversion
    630631        # is used by the PolyBoRi python code often
     
    653654                    p *= var_mapping[i]
    654655                return p
    655656            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)
    657658
    658659        elif PY_TYPE_CHECK(other,BooleanPolynomial) and \
    659660            ((<BooleanPolynomialRing>(<BooleanPolynomial>other)\
     
    749750            ...
    750751            TypeError: cannot convert polynomial z*x^2 + 5*y^3 to Boolean PolynomialRing in x, y: name z not defined
    751752        """
     753        msg = None
    752754        cdef int i
    753755
    754756        try:
     
    19411943                            m*= var_mapping[i]
    19421944                        return m
    19431945                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)
    19451947
    19461948        elif PY_TYPE_CHECK(other, BooleanMonomial) and \
    19471949            ((<BooleanMonomial>other)._pbmonom.deg() <= \
  • sage/rings/real_double.pyx

    diff -r 2a2abbcad325 -r 8c8c6740b23f sage/rings/real_double.pyx
    a b  
    16741674                return exponent.parent()(self) ** exponent # neither operand is RealDoubleElement
    16751675        else:
    16761676            try:
    1677                 base = exp.parent()(self)
     1677                base = exponent.parent()(self)
    16781678                return base.__pow_float((<RealDoubleElement>exponent)._value)
    16791679            except TypeError:
    16801680                return self ** self.parent()(exponent) # neither operand is RealDoubleElement
  • sage/rings/real_mpfi.pyx

    diff -r 2a2abbcad325 -r 8c8c6740b23f sage/rings/real_mpfi.pyx
    a b  
    999999            mpfi_set_fr(self.value, rn.value)
    10001000        elif PY_TYPE_CHECK(x, Rational):
    10011001            rat = x
    1002             mpfi_set_q(self.value, <mpq_t> rat.value)
     1002            mpfi_set_q(self.value, rat.value)
    10031003        elif PY_TYPE_CHECK(x, Integer):
    10041004            integ = x
    1005             mpfi_set_z(self.value, <mpz_t> integ.value)
     1005            mpfi_set_z(self.value, integ.value)
    10061006        elif PY_TYPE_CHECK(x, int):
    10071007            ix = x
    10081008            mpfi_set_si(self.value, ix)
  • sage/structure/coerce.pyx

    diff -r 2a2abbcad325 -r 8c8c6740b23f sage/structure/coerce.pyx
    a b  
    514514            2
    515515            """
    516516        self._exceptions_cleared = False
     517        res = None
    517518        if not PY_TYPE_CHECK(xp, type) and not PY_TYPE_CHECK(xp, Parent):
    518519            xp = parent_c(xp)
    519520        if not PY_TYPE_CHECK(yp, type) and not PY_TYPE_CHECK(yp, Parent):
     
    710711                return (<Action>action)._call_(x, y)
    711712       
    712713        try:
     714            xy = None
    713715            xy = self.canonical_coercion(x,y)
    714716            return PyObject_CallObject(op, xy)
    715717        except TypeError, err:
  • sage/symbolic/expression.pyx

    diff -r 2a2abbcad325 -r 8c8c6740b23f sage/symbolic/expression.pyx
    a b  
    19561956            falsify = operator.lt
    19571957        cdef bint equality_ok = op in [equal, less_or_equal, greater_or_equal]
    19581958        cdef int errors = 0
     1959        val = None
    19591960        if len(vars) == 0:
    1960             val = None
    19611961            try:
    19621962                val = domain(diff)
    19631963            except (TypeError, ValueError, ArithmeticError), ex:
     
    25632563            sage: x^oo
    25642564            Traceback (most recent call last):
    25652565            ...
    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.
    25672567            sage: SR(oo)^2
    25682568            +Infinity
    25692569            sage: SR(-oo)^2
     
    34533453            sage: (x^y).subs(x=oo)
    34543454            Traceback (most recent call last):
    34553455            ...
    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.
    34573457            sage: (x^y).subs(y=oo)
    34583458            Traceback (most recent call last):
    34593459            ...
    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.
    34613461            sage: (x+y).subs(x=oo)
    34623462            +Infinity
    34633463            sage: (x-y).subs(y=oo)
  • setup.py

    diff -r 2a2abbcad325 -r 8c8c6740b23f setup.py
    a b  
    805805            cplus = ''
    806806
    807807        # 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)
    809809        r = run_command(cmd)
    810810        if r:
    811811            return r