Ticket #6781: trac_6781-review.patch

File trac_6781-review.patch, 3.3 KB (added by burcin, 9 years ago)

apply after ecllib.patch

  • module_list.py

    # HG changeset patch
    # User Burcin Erocal <burcin@erocal.org>
    # Date 1270251191 -7200
    # Node ID 10de7f23ddb4013233504adc7abe90760884f8c9
    # Parent  b7495417f9a2bfb3b57aab7bb3a1a34285e3be3c
    trac 6781: minor cosmetic changes to the ecl library interface.
    
    diff --git a/module_list.py b/module_list.py
    a b  
    398398    ################################
    399399
    400400    Extension('sage.libs.ecl',
    401               sources = ["sage/libs/ecl/ecl.pyx"],
     401              sources = ["sage/libs/ecl.pyx"],
    402402              libraries = ["ecl"],
    403403              include_dirs = [SAGE_ROOT+'/local/include/ecl/'],
    404404              depends = [SAGE_ROOT + '/local/include/ecl/ecl.h']),
  • ecl.pyx

    diff --git a/sage/libs/ecl/ecl.pxd b/sage/libs/ecl.pxd
    rename from sage/libs/ecl/ecl.pxd
    rename to sage/libs/ecl.pxd
    diff --git a/sage/libs/ecl/ecl.pyx b/sage/libs/ecl.pyx
    rename from sage/libs/ecl/ecl.pyx
    rename to sage/libs/ecl.pyx
    old new  
    1313#rationals to SAGE types Integer and Rational. These parts could easily be
    1414#adapted to work with pure Python types.
    1515
    16 cimport sage.rings.integer
     16include "../ext/interrupt.pxi"
     17include "../ext/stdsage.pxi"
     18include "../ext/cdefs.pxi"
     19
    1720from sage.rings.integer cimport Integer
    18 import sage.rings.integer
    19 from sage.rings.integer import Integer
    20 cimport sage.rings.rational
    2121from sage.rings.rational cimport Rational
    22 import sage.rings.rational
    2322from sage.rings.rational import Rational
    2423
    2524#it would be preferrable to let bint_symbolp wrap an efficient macro
     
    277276            return Ct
    278277        else:
    279278            return Cnil
    280     elif pyobj==None:
     279    elif pyobj is None:
    281280        return Cnil
    282281    elif isinstance(pyobj,int):
    283282        return ecl_make_integer(pyobj)
     
    630629            NotImplementedError: EclObjects can only be compared for equality
    631630            sage: EclObject("<")(a,b)
    632631            <ECL: T>
    633 
    634632        """
    635    
    636633        if   op == 2: # "=="
    637634            if not(isinstance(left,EclObject)) or not(isinstance(right,EclObject)):
    638635                return False
     
    650647        #inappropriate for an *interface*.
    651648        raise NotImplementedError,"EclObjects can only be compared for equality"
    652649 
    653         if not(isinstance(left,EclObject)) or not(isinstance(right,EclObject)):
    654             raise TypeError,"Can only compare EclObjects"
    655         if op == 0: # "<"
    656             pass
    657         elif op == 1: # "<="
    658             pass
    659         elif op == 4: # ">"
    660             pass
    661         elif op == 5: # ">="
    662             pass
    663         else:
    664             raise ValueError,"richcmp received operation code %d"%op
     650        #if not(isinstance(left,EclObject)) or not(isinstance(right,EclObject)):
     651        #    raise TypeError,"Can only compare EclObjects"
     652        #if op == 0: # "<"
     653        #    pass
     654        #elif op == 1: # "<="
     655        #    pass
     656        #elif op == 4: # ">"
     657        #    pass
     658        #elif op == 5: # ">="
     659        #    pass
     660        #else:
     661        #    raise ValueError,"richcmp received operation code %d"%op
    665662
    666663    def eval(self):
    667664        r"""
     
    993990
    994991#input: a cl-object. Output: EclObject wrapping that.
    995992cdef EclObject ecl_wrap(cl_object o):
    996     cdef EclObject obj
    997     obj = EclObject()
     993    cdef EclObject obj = PY_NEW(EclObject)
    998994    obj.set_obj(o)
    999995    return obj
    1000996