Ticket #13447: trac_13447-modulus_fix.patch

File trac_13447-modulus_fix.patch, 771 bytes (added by nbruin, 7 years ago)

return NULL instead of raising AttributeError?

  • sage/rings/polynomial/polynomial_zz_pex.pyx

    # HG changeset patch
    # User Nils Bruin <nbruin@sfu.ca>
    # Date 1347864235 25200
    # Node ID 4d74673e4d86bbfb0656d802c0b1b2fde31ef777
    # Parent  0e86470509c39d43410f1b3e546b331bee1703fb
    #13447: fix polynomial_zz_pex.get_cparent to return NULL on AttributeError
    
    diff --git a/sage/rings/polynomial/polynomial_zz_pex.pyx b/sage/rings/polynomial/polynomial_zz_pex.pyx
    a b cdef cparent get_cparent(parent) except? 
    2828    if parent is None:
    2929        return NULL
    3030    cdef ntl_ZZ_pEContext_class c
    31     c = parent._modulus
     31    try:
     32        c = parent._modulus
     33    except AttributeError:
     34        return NULL
    3235    return &(c.x)
    3336
    3437# first we include the definitions