Ticket #7794: 7794_get_cparent.patch

File 7794_get_cparent.patch, 1.8 KB (added by jdemeyer, 11 years ago)
  • sage/rings/polynomial/polynomial_gf2x.pyx

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1305958837 -7200
    # Node ID 5655998908b8797a2108b8e8cac38d705faa3804
    # Parent  c188b4b961d99b90010707ec8eec02d5fca3dcac
    Allow exceptions in get_cparent()
    
    diff -r c188b4b961d9 -r 5655998908b8 sage/rings/polynomial/polynomial_gf2x.pyx
    a b  
    1111# 'polynomial_template.pxi'.
    1212
    1313ctypedef long cparent
    14 cdef cparent get_cparent(parent):
     14cdef inline cparent get_cparent(parent):
    1515    return 0
    1616
    1717# first we include the definitions
  • sage/rings/polynomial/polynomial_zmod_flint.pyx

    diff -r c188b4b961d9 -r 5655998908b8 sage/rings/polynomial/polynomial_zmod_flint.pyx
    a b  
    4343
    4444ctypedef unsigned long cparent
    4545
    46 cdef inline cparent get_cparent(parent):
    47     if parent is None:
     46cdef inline cparent get_cparent(parent) except? 0:
     47    try:
     48        return <unsigned long>(parent.modulus())
     49    except AttributeError:
    4850        return 0
    49     try:
    50         m = parent.modulus()
    51     except:
    52         return 0
    53     return <unsigned long>(parent.modulus())
    5451
    5552# first we include the definitions
    5653include "../../libs/flint/zmod_poly_linkage.pxi"
  • sage/rings/polynomial/polynomial_zz_pex.pyx

    diff -r c188b4b961d9 -r 5655998908b8 sage/rings/polynomial/polynomial_zz_pex.pyx
    a b  
    2424
    2525ctypedef ZZ_pEContext_c *cparent
    2626
    27 cdef cparent get_cparent(parent):
     27cdef cparent get_cparent(parent) except? NULL:
    2828    if parent is None:
    2929        return NULL
    3030    cdef ntl_ZZ_pEContext_class c