Ticket #9880: trac_9880_pynac_order.take2.patch

File trac_9880_pynac_order.take2.patch, 2.2 KB (added by burcin, 9 years ago)

updated JP's patch for sage library to work with the new order patches

  • sage/libs/ginac/decl.pxi

    # HG changeset patch
    # User Jean-Pierre Flori <flori@enst.fr>
    # Date 1298990841 -3600
    # Node ID 1690c2e5a2ccf87deb24dac74ba76299c5a2f307
    # Parent  d668124d013b6862f2b40c1c12061f96e0817712
    Trac #9880: Give Sage access to the PyNaC printing order
    
    This allows automated doctests to check the PyNaC printing
    sort order.
    
    diff --git a/sage/libs/ginac/decl.pxi b/sage/libs/ginac/decl.pxi
    a b  
    505505        object (*py_rational_power_parts)(object basis, object exp)
    506506
    507507    py_funcs_struct py_funcs "GiNaC::py_funcs"
     508
     509cdef extern from "pynac/order.h":
     510    bint print_order "GiNaC::print_order()" \
     511            (GEx left, GEx right) except +
     512    bint print_order_mul "GiNaC::print_order_mul()" \
     513            (GEx left, GEx right) except +
  • sage/symbolic/expression.pxd

    diff --git a/sage/symbolic/expression.pxd b/sage/symbolic/expression.pxd
    a b  
    22
    33from sage.structure.element cimport CommutativeRingElement
    44
    5 
    65cdef class Expression(CommutativeRingElement):
    76    cdef GEx _gobj
    87    cdef Expression coerce_in(self, z)
     
    1211    cpdef bint is_relational(self)
    1312    cpdef object pyobject(self)
    1413    cpdef Expression _subs_expr(self, expr)
     14    cpdef int _cmp_add(left, CommutativeRingElement right) except -2
     15    cpdef int _cmp_mul(left, CommutativeRingElement right) except -2
    1516   
    1617cdef Expression new_Expression_from_GEx(parent, GEx juice)
    1718cdef Expression new_Expression_from_pyobject(parent, x)
     19
  • sage/symbolic/expression.pyx

    diff --git a/sage/symbolic/expression.pyx b/sage/symbolic/expression.pyx
    a b  
    24062406    cdef int _cmp_c_impl(left, Element right) except -2:
    24072407        return left._gobj.compare((<Expression>right)._gobj)
    24082408
     2409    cpdef int _cmp_add(left, CommutativeRingElement right) except -2:
     2410        return print_order(left._gobj,(<Expression>right)._gobj)
     2411
     2412    cpdef int _cmp_mul(left, CommutativeRingElement right) except -2:
     2413        return print_order_mul(left._gobj,(<Expression>right)._gobj)
     2414
    24092415    def __pow__(self, exp, ignored):
    24102416        """
    24112417        Return self raised to the power of exp.