Ticket #11761: 11761-cython-0.15-rebased.patch

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

    # HG changeset patch
    # User Robert Bradshaw <robertwb@math.washington.edu>
    # Date 1314767776 25200
    # Node ID ef87efd57797f2c75f24e7df62edbf80219bce38
    # Parent  23434d5c5353c6d5c09cecca0b1bcc3cd9ac643b
    #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 --git a/sage/coding/binary_code.pyx b/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 --git a/sage/libs/singular/function.pyx b/sage/libs/singular/function.pyx
    a b  
    11071107        """
    11081108        from  sage.matrix.matrix_mpolynomial_dense import Matrix_mpolynomial_dense
    11091109        from sage.matrix.matrix_integer_dense import Matrix_integer_dense
     1110        ring2 = None
    11101111        for a in args:
    11111112            if PY_TYPE_CHECK(a, MPolynomialIdeal):
    11121113                ring2 = a.ring()
  • sage/matrix/matrix_dense.pyx

    diff --git a/sage/matrix/matrix_dense.pyx b/sage/matrix/matrix_dense.pyx
    a b  
    403403            image.subdivide(*self.subdivisions())
    404404        return image
    405405
    406     def _derivative(self, var=None):
     406    def _derivative(self, var=None, R=None):
    407407        """
    408408        Differentiate with respect to var by differentiating each element
    409409        with respect to var.
  • sage/matrix/matrix_double_dense.pyx

    diff --git a/sage/matrix/matrix_double_dense.pyx b/sage/matrix/matrix_double_dense.pyx
    a b  
    30583058        """
    30593059        if algorithm not in ('pade', 'eig', 'taylor'):
    30603060            raise ValueError("algorithm must be 'pade', 'eig', or 'taylor'")
    3061            
     3061
     3062        global scipy
    30623063        if scipy is None:
    30633064            import scipy
    30643065        import scipy.linalg
  • sage/matrix/matrix_integer_dense.pyx

    diff --git a/sage/matrix/matrix_integer_dense.pyx b/sage/matrix/matrix_integer_dense.pyx
    a b  
    16211621
    16221622        proof = get_proof_flag(proof, "linear_algebra")
    16231623        pivots = None
     1624        rank = None
    16241625
    16251626        if algorithm == "padic":
    16261627            import matrix_integer_dense_hnf
  • sage/matrix/matrix_sparse.pyx

    diff --git a/sage/matrix/matrix_sparse.pyx b/sage/matrix/matrix_sparse.pyx
    a b  
    663663            m.subdivide(*self.subdivisions())
    664664        return m
    665665
    666     def _derivative(self, var=None):
     666    def _derivative(self, var=None, R=None):
    667667        """
    668668        Differentiate with respect to var by differentiating each element
    669669        with respect to var.
  • sage/matrix/misc.pyx

    diff --git a/sage/matrix/misc.pyx b/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 --git a/sage/misc/misc_c.pyx b/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 --git a/sage/plot/plot3d/base.pyx b/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 --git a/sage/rings/fraction_field_element.pyx b/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 --git a/sage/rings/integer.pyx b/sage/rings/integer.pyx
    a b  
    41484148            raise RuntimeError, "Inconsistent results between GMP and PARI"
    41494149        return g.isprime(flag=flag)
    41504150
    4151     def is_prime(self):
     4151    def is_prime(self, proof=None):
    41524152        r"""
    41534153        Returns ``True`` if ``self`` is prime.
    41544154       
  • sage/rings/polynomial/pbori.pyx

    diff --git a/sage/rings/polynomial/pbori.pyx b/sage/rings/polynomial/pbori.pyx
    a b  
    627627            sage: I.groebner_basis()
    628628            [1]
    629629        """
     630        msg = None
    630631        cdef BooleanPolynomial p
    631632        # we check for other PolyBoRi types first since this conversion
    632633        # is used by the PolyBoRi python code often
     
    655656                    p *= var_mapping[i]
    656657                return p
    657658            else:
    658                 raise TypeError, "cannot coerce monomial %s to %s: %s"%(other,self,msg)
     659                raise TypeError, "cannot coerce monomial %s to %s"%(other,self)
    659660
    660661        elif PY_TYPE_CHECK(other,BooleanPolynomial) and \
    661662            ((<BooleanPolynomialRing>(<BooleanPolynomial>other)\
     
    751752            ...
    752753            TypeError: cannot convert polynomial z*x^2 + 5*y^3 to Boolean PolynomialRing in x, y: name z not defined
    753754        """
     755        msg = None
    754756        cdef int i
    755757
    756758        try:
     
    19431945                            m*= var_mapping[i]
    19441946                        return m
    19451947                else:
    1946                     raise ValueError, "cannot convert polynomial %s to %s: %s"%(other,self,msg)
     1948                    raise ValueError, "cannot convert polynomial %s to %s"%(other,self)
    19471949
    19481950        elif PY_TYPE_CHECK(other, BooleanMonomial) and \
    19491951            ((<BooleanMonomial>other)._pbmonom.deg() <= \
  • sage/rings/real_double.pyx

    diff --git a/sage/rings/real_double.pyx b/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 --git a/sage/rings/real_mpfi.pyx b/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 --git a/sage/structure/coerce.pyx b/sage/structure/coerce.pyx
    a b  
    543543            2
    544544            """
    545545        self._exceptions_cleared = False
     546        res = None
    546547        if not PY_TYPE_CHECK(xp, type) and not PY_TYPE_CHECK(xp, Parent):
    547548            xp = parent_c(xp)
    548549        if not PY_TYPE_CHECK(yp, type) and not PY_TYPE_CHECK(yp, Parent):
     
    739740                return (<Action>action)._call_(x, y)
    740741       
    741742        try:
     743            xy = None
    742744            xy = self.canonical_coercion(x,y)
    743745            return PyObject_CallObject(op, xy)
    744746        except TypeError, err:
  • sage/symbolic/expression.pyx

    diff --git a/sage/symbolic/expression.pyx b/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:
     
    25642564            sage: x^oo
    25652565            Traceback (most recent call last):
    25662566            ...
    2567             RuntimeError: power::eval(): pow(x, Infinity) for non numeric x is not defined.
     2567            ValueError: power::eval(): pow(x, Infinity) for non numeric x is not defined.
    25682568            sage: SR(oo)^2
    25692569            +Infinity
    25702570            sage: SR(-oo)^2
     
    34543454            sage: (x^y).subs(x=oo)
    34553455            Traceback (most recent call last):
    34563456            ...
    3457             RuntimeError: power::eval(): pow(Infinity, x) for non numeric x is not defined.
     3457            ValueError: power::eval(): pow(Infinity, x) for non numeric x is not defined.
    34583458            sage: (x^y).subs(y=oo)
    34593459            Traceback (most recent call last):
    34603460            ...
    3461             RuntimeError: power::eval(): pow(x, Infinity) for non numeric x is not defined.
     3461            ValueError: power::eval(): pow(x, Infinity) for non numeric x is not defined.
    34623462            sage: (x+y).subs(x=oo)
    34633463            +Infinity
    34643464            sage: (x-y).subs(y=oo)
  • setup.py

    diff --git a/setup.py b/setup.py
    a b  
    766766            cplus = ''
    767767
    768768        # call cython, abort if it failed
    769         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)
     769        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)
    770770        r = run_command(cmd)
    771771        if r:
    772772            return r