Ticket #6590: 6590-cinit_rebased.patch

File 6590-cinit_rebased.patch, 43.4 KB (added by Alex Ghitza, 13 years ago)

rebased against sage-4.1.1, apply instead of previous patch

  • sage/algebras/quatalg/quaternion_algebra_element.pyx

    # HG changeset patch
    # User Robert Bradshaw <robertwb@math.washington.edu>
    # Date 1248213229 25200
    # Node ID 5cf13bf8083a8175e36370b3eb713b21d446cd32
    # Parent  684eea91ff224e5bc6259ca19f1576c4c082b9d3
    __new__ should be __cinit__
    
    diff -r 684eea91ff22 -r 5cf13bf8083a sage/algebras/quatalg/quaternion_algebra_element.pyx
    a b  
    14741474
    14751475
    14761476cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstract):
    1477     def __new__(self):
     1477    def __cinit__(self):
    14781478        """
    14791479        Allocate memory for this quaternion over a number field.
    14801480        """
  • sage/coding/binary_code.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/coding/binary_code.pyx
    a b  
    705705        [11111111111111111111111111111111]
    706706
    707707    """
    708     def __new__(self, arg1, arg2=None):
     708    def __cinit__(self, arg1, arg2=None):
    709709        cdef int nrows, i, j, size
    710710        cdef int nwords, other_nwords, parity, combination
    711711        cdef codeword word, glue_word
     
    12131213    * http://en.wikipedia.org/wiki/Disjoint-set_data_structure
    12141214
    12151215    """
    1216     def __new__(self, int nrows, int ncols):
     1216    def __cinit__(self, int nrows, int ncols):
    12171217        cdef int col
    12181218        cdef int nwords, word
    12191219        nwords = (1 << nrows)
     
    15141514    group computation.
    15151515
    15161516    """
    1517     def __new__(self, arg1, arg2=None):
     1517    def __cinit__(self, arg1, arg2=None):
    15181518        cdef int k, nwords, ncols, sizeof_int
    15191519        cdef PartitionStack other
    15201520        cdef int *wd_ents, *wd_lvls, *col_ents, *col_lvls
     
    29742974
    29752975cdef class BinaryCodeClassifier:
    29762976
    2977     def __new__(self):
     2977    def __cinit__(self):
    29782978        self.radix = sizeof(codeword) << 3
    29792979        self.ham_wts = hamming_weights()
    29802980        self.L = 100 # memory limit for Phi and Omega- multiply by 8KB
  • sage/combinat/matrices/dancing_links.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/combinat/matrices/dancing_links.pyx
    a b  
    6666        """
    6767        pass       
    6868
    69     # Note that the parameters to __new__ must be identical to __init__
    70     # This is due to some Cython vagary
    71     def __new__(self, rows):
     69    # Note that the parameters to __cinit__, if any, must be identical to __init__
     70    # This is due to the way Python constructs class instance.
     71    def __cinit__(self, rows):
    7272        self.rows = PyList_New(len(rows))
    7373        dancing_links_construct(&self.x)
    7474        self.add_rows(rows)
  • sage/ext/multi_modular.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/ext/multi_modular.pyx
    a b  
    7474        MultiModularBasis with moduli [11, 13, 17, 19]
    7575    """
    7676
    77     def __new__(self, *args, **kwds):
     77    def __cinit__(self):
    7878        r"""
    7979        Allocate the space for the moduli and precomputation lists
    8080        and initialize the first element of that list.
  • sage/finance/time_series.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/finance/time_series.pyx
    a b  
    5757digits = 4
    5858   
    5959cdef class TimeSeries:
    60     def __new__(self, values=None):
     60    def __cinit__(self):
    6161        """
    6262        Create new empty uninitialized time series.
    6363
  • sage/graphs/base/dense_graph.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/graphs/base/dense_graph.pyx
    a b  
    154154
    155155    """
    156156   
    157     def __new__(self, int nverts, int extra_vertices = 10, verts = None, arcs = None):
     157    def __cinit__(self, int nverts, int extra_vertices = 10, verts = None, arcs = None):
    158158        """
    159159        Allocation and initialization happen in one place.
    160160       
  • sage/graphs/base/sparse_graph.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/graphs/base/sparse_graph.pyx
    a b  
    283283   
    284284    """
    285285   
    286     def __new__(self, int nverts, int expected_degree = 16, int extra_vertices = 10, verts=None, arcs=None):
     286    def __cinit__(self, int nverts, int expected_degree = 16, int extra_vertices = 10, verts=None, arcs=None):
    287287        """
    288288        Allocation and initialization happen in one place.
    289289       
  • sage/groups/perm_gps/partn_ref/refinement_binary.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/groups/perm_gps/partn_ref/refinement_binary.pyx
    a b  
    2828
    2929cdef class LinearBinaryCodeStruct(BinaryCodeStruct):
    3030   
    31     def __new__(self, matrix):
     31    def __cinit__(self, matrix):
    3232        cdef int i,j
    3333        self.degree = matrix.ncols()
    3434        self.dimension = matrix.nrows()
     
    378378
    379379cdef class NonlinearBinaryCodeStruct(BinaryCodeStruct):
    380380   
    381     def __new__(self, arg):
     381    def __cinit__(self, arg):
    382382        cdef int i,j
    383383        if is_Matrix(arg):
    384384            self.degree = arg.ncols()
  • sage/groups/perm_gps/partn_ref/refinement_matrices.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/groups/perm_gps/partn_ref/refinement_matrices.pyx
    a b  
    2929
    3030cdef class MatrixStruct:
    3131   
    32     def __new__(self, matrix):
     32    def __cinit__(self, matrix):
    3333        cdef int i, j
    3434        cdef int *num_rows
    3535        self.degree = matrix.ncols()
  • sage/gsl/dwt.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/gsl/dwt.pyx
    a b  
    9797DWT = WaveletTransform
    9898
    9999cdef class DiscreteWaveletTransform(gsl_array.GSLDoubleArray):
    100     def __new__(self,size_t n,size_t stride, wavelet_type, size_t wavelet_k):
     100    def __cinit__(self,size_t n,size_t stride, wavelet_type, size_t wavelet_k):
    101101        self.wavelet = NULL
    102102        self.workspace = NULL
    103103
  • sage/libs/flint/fmpz_poly.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/flint/fmpz_poly.pyx
    a b  
    3131
    3232cdef class Fmpz_poly(SageObject):
    3333   
    34     def __new__(self, v=None):
     34    def __cinit__(self):
    3535        fmpz_poly_init(self.poly)
    3636       
    3737    def __init__(self, v):
  • sage/libs/fplll/fplll.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/fplll/fplll.pyx
    a b  
    4545    NOTE: Usually you don't want to create this object yourself but
    4646    use the LLL method of the integer matrices.
    4747    """
    48     def __new__(self, Matrix_integer_dense A):
     48    def __cinit__(self, Matrix_integer_dense A):
    4949        """
    5050        Construct a new fpLLL wrapper for the matrix A.
    5151
  • sage/libs/ntl/ntl_GF2.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_GF2.pyx
    a b  
    5555            GF2_from_str(&self.x, v)
    5656            _sig_off
    5757
    58     def __new__(self, v=None):
     58    def __cinit__(self):
    5959        GF2_construct(&self.x)
    6060
    6161    def __dealloc__(self):
  • sage/libs/ntl/ntl_GF2E.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_GF2E.pyx
    a b  
    121121            _x = ntl_GF2X(x)
    122122            GF2E_conv_GF2X(self.x, _x.x)
    123123
    124     def __new__(self, x=None, modulus=None):
     124    def __cinit__(self, x=None, modulus=None):
    125125        #################### WARNING ###################
    126126        ## Before creating a GF2E, you must create a  ##
    127127        ## GF2EContext, and restore it.  In Python,   ##
  • sage/libs/ntl/ntl_GF2EContext.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_GF2EContext.pyx
    a b  
    4646        """
    4747        pass
    4848       
    49     def __new__(self, ntl_GF2X v):
     49    def __cinit__(self, ntl_GF2X v):
    5050        GF2EContext_construct_GF2X(&self.x, &((<ntl_GF2X>v).x))
    5151        self.m = v
    5252
  • sage/libs/ntl/ntl_GF2EX.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_GF2EX.pyx
    a b  
    5353        GF2EX_from_str(&self.x, s)
    5454        _sig_off
    5555
    56     def __new__(self, modulus=None, x=[]):
     56    def __cinit__(self, modulus=None, x=[]):
    5757        #################### WARNING ###################
    5858        ## Before creating a GF2E, you must create a  ##
    5959        ## GF2EContext, and restore it.  In Python,   ##
  • sage/libs/ntl/ntl_GF2X.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_GF2X.pyx
    a b  
    161161        GF2X_from_str(&self.x, s)
    162162        _sig_off
    163163
    164     def __new__(self, x=[]):
     164    def __cinit__(self):
    165165        GF2X_construct(&self.x)
    166166
    167167    def __dealloc__(self):
  • sage/libs/ntl/ntl_ZZ.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_ZZ.pyx
    a b  
    9393            ZZ_from_str(&self.x, v)
    9494            _sig_off
    9595
    96     def __new__(self, v=None):
     96    def __cinit__(self):
    9797        ZZ_construct(&self.x)
    9898
    9999    def __dealloc__(self):
  • sage/libs/ntl/ntl_ZZX.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_ZZX.pyx
    a b  
    129129        """
    130130        return unpickle_class_value, (ntl_ZZX, self.list())
    131131
    132     def __new__(self, v=None):
     132    def __cinit__(self):
    133133        ZZX_construct(&self.x)
    134134
    135135    def __dealloc__(self):
  • sage/libs/ntl/ntl_ZZ_p.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_ZZ_p.pyx
    a b  
    120120                ZZ_p_from_str(&self.x, v)
    121121            _sig_off
    122122
    123     def __new__(self, v=None, modulus=None):
     123    def __cinit__(self, v=None, modulus=None):
    124124        #################### WARNING ###################
    125125        ## Before creating a ZZ_p, you must create a  ##
    126126        ## ZZ_pContext, and restore it.  In Python,   ##
  • sage/libs/ntl/ntl_ZZ_pContext.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_ZZ_pContext.pyx
    a b  
    4747        """
    4848        pass
    4949       
    50     def __new__(self, ntl_ZZ v):
     50    def __cinit__(self, ntl_ZZ v):
    5151        ZZ_pContext_construct_ZZ(&self.x, &(<ntl_ZZ>v).x)
    5252        self.p = v
    5353        self.p_bits = self.p._integer_().nbits()
  • sage/libs/ntl/ntl_ZZ_pE.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_ZZ_pE.pyx
    a b  
    138138                ZZ_pE_from_str(&self.x, PyString_AsString(v))
    139139            _sig_off
    140140
    141     def __new__(ntl_ZZ_pE self, v=None, modulus=None):
     141    def __cinit__(ntl_ZZ_pE self, v=None, modulus=None):
    142142        #################### WARNING ###################
    143143        ## Before creating a ZZ_pE, you must create a ##
    144144        ## ZZ_pEContext, and restore it.  In Python,  ##
  • sage/libs/ntl/ntl_ZZ_pEContext.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_ZZ_pEContext.pyx
    a b  
    4545        """
    4646        pass
    4747       
    48     def __new__(self, ntl_ZZ_pX f):
     48    def __cinit__(self, ntl_ZZ_pX f):
    4949        self.pc = f.c
    5050        self.pc.restore_c()
    5151        ZZ_pEContext_construct_ZZ_pX(&self.x, &f.x)
  • sage/libs/ntl/ntl_ZZ_pEX.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_ZZ_pEX.pyx
    a b  
    9595            #ZZ_pEX_from_str(&self.x, s)
    9696            #_sig_off
    9797
    98     def __new__(self, v=None, modulus=None):
     98    def __cinit__(self, v=None, modulus=None):
    9999        #################### WARNING ###################
    100100        ## Before creating a ZZ_pEX, you must create a##
    101101        ## ZZ_pEContext, and restore it.  In Python,  ##
  • sage/libs/ntl/ntl_ZZ_pX.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_ZZ_pX.pyx
    a b  
    102102            ZZ_pX_from_str(&self.x, s)
    103103            _sig_off
    104104
    105     def __new__(self, v=None, modulus=None):
     105    def __cinit__(self, v=None, modulus=None):
    106106        #################### WARNING ###################
    107107        ## Before creating a ZZ_pX, you must create a ##
    108108        ## ZZ_pContext, and restore it.  In Python,   ##
     
    13391339    """
    13401340    Thin holder for ZZ_pX_Moduli.
    13411341    """
    1342     def __new__(self, ntl_ZZ_pX poly):
     1342    def __cinit__(self, ntl_ZZ_pX poly):
    13431343        ZZ_pX_Modulus_construct(&self.x)
    13441344        ZZ_pX_Modulus_build(self.x, poly.x)
    13451345        self.poly = poly
  • sage/libs/ntl/ntl_lzz_p.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_lzz_p.pyx
    a b  
    118118
    119119        return
    120120
    121     def __new__(self, v=None, modulus=None):
     121    def __cinit__(self, v=None, modulus=None):
    122122        #################### WARNING ###################
    123123        ## Before creating a zz_p, you must create a  ##
    124124        ## zz_pContext, and restore it.  In Python,   ##
  • sage/libs/ntl/ntl_lzz_pContext.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_lzz_pContext.pyx
    a b  
    4646        """
    4747        pass
    4848       
    49     def __new__(self, long v):
     49    def __cinit__(self, long v):
    5050        if v > NTL_SP_BOUND:
    5151            raise ValueError, "Modulus (=%s) is too big"%v
    5252        zz_pContext_construct_long(&self.x, v)
  • sage/libs/ntl/ntl_lzz_pX.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_lzz_pX.pyx
    a b  
    134134
    135135        return
    136136
    137     def __new__(self, v=None, modulus=None):
     137    def __cinit__(self, v=None, modulus=None):
    138138        #################### WARNING ###################
    139139        ## Before creating a zz_pX, you must create a ##
    140140        ## zz_pContext, and restore it.  In Python,   ##
  • sage/libs/ntl/ntl_mat_GF2.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_mat_GF2.pyx
    a b  
    111111                    mat_GF2_setitem(&self.x, i, j, &(<ntl_GF2>elem).x)
    112112            _sig_off
    113113
    114     def __new__(self, modulus=None, nrows=0, ncols=0, v=None):
     114    def __cinit__(self):
    115115        mat_GF2_construct(&self.x)
    116116
    117117    cdef ntl_GF2 _new_element(self):
  • sage/libs/ntl/ntl_mat_GF2E.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_mat_GF2E.pyx
    a b  
    102102                    mat_GF2E_setitem(&self.x, i, j, &(<ntl_GF2E>elem).x)
    103103            _sig_off
    104104
    105     def __new__(self, modulus=None, nrows=0, ncols=0, v=None):
     105    def __cinit__(self, modulus=None, nrows=0, ncols=0, v=None):
    106106        #################### WARNING ###################
    107107        ## Before creating a GF2E, you must create a  ##
    108108        ## GF2EContext, and restore it.  In Python,   ##
  • sage/libs/ntl/ntl_mat_ZZ.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/libs/ntl/ntl_mat_ZZ.pyx
    a b  
    109109        """
    110110        return unpickle_class_args, (ntl_mat_ZZ, (self.__nrows, self.__ncols, self.list()))
    111111
    112     def __new__(self, nrows=0,  ncols=0, v=None):
     112    def __cinit__(self):
    113113        mat_ZZ_construct(&self.x)
    114114
    115115    def __dealloc__(self):
  • sage/matrix/docs.py

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/matrix/docs.py
    a b  
    155155    For each base field it is *absolutely* essential to completely
    156156    implement the following functionality for that base ring:
    157157       
    158        * __new__       -- should use sage_malloc from ext/stdsage.pxi (only
     158       * __cinit__     -- should use sage_malloc from ext/stdsage.pxi (only
    159159                          needed if allocate memory)
    160160       * __init__      -- this signature: 'def __init__(self, parent, entries, copy, coerce)'
    161161       * __dealloc__   -- use sage_free (only needed if allocate memory)
  • sage/matrix/matrix_complex_double_dense.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/matrix/matrix_complex_double_dense.pyx
    a b  
    8787   
    8888    ########################################################################
    8989    # LEVEL 1 functionality
    90     #   * __new__ 
     90    #   * __cinit__ 
    9191    #   * __dealloc__   
    9292    #   * __init__     
    9393    #   * set_unsafe
     
    9595    #   * __richcmp__    -- always the same
    9696    #   * __hash__       -- always simple
    9797    ########################################################################
    98     def __new__(self, parent, entries, copy, coerce):
     98    def __cinit__(self, parent, entries, copy, coerce):
    9999        global numpy
    100100        if numpy is None:
    101101            import numpy
  • sage/matrix/matrix_cyclo_dense.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/matrix/matrix_cyclo_dense.pyx
    a b  
    7070cdef class Matrix_cyclo_dense(matrix_dense.Matrix_dense):
    7171    ########################################################################
    7272    # LEVEL 1 functionality
    73     # x * __new__ 
     73    # x * __cinit__ 
    7474    # x * __dealloc__     (not needed)
    7575    # x * __init__     
    7676    # x * set_unsafe
     
    7979    # x * _unpickle
    8080    ########################################################################
    8181   
    82     def __new__(self, parent, entries, coerce, copy):
     82    def __cinit__(self, parent, entries, coerce, copy):
    8383        """
    8484        Create a new dense cyclotomic matrix.
    8585
  • sage/matrix/matrix_double_dense.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/matrix/matrix_double_dense.pyx
    a b  
    8080   
    8181    ########################################################################
    8282    # LEVEL 1 functionality
    83     #   * __new__ 
     83    #   * __cinit__ 
    8484    #   * __dealloc__   
    8585    #   * __init__     
    8686    #   * set_unsafe
     
    8888    #   * __richcmp__    -- always the same
    8989    #   * __hash__       -- always simple
    9090    ########################################################################
    91     def __new__(self, parent, entries, copy, coerce):
     91    def __cinit__(self, parent, entries, copy, coerce):
    9292        """
    9393        Set up a new matrix
    9494        """
  • sage/matrix/matrix_generic_dense.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/matrix/matrix_generic_dense.pyx
    a b  
    4848    """
    4949    ########################################################################
    5050    # LEVEL 1 functionality
    51     # 0 * __new__   (not needed)
     51    # 0 * __cinit__   (not needed)
    5252    # x * __init__       
    5353    # 0 * __dealloc__   (not needed)
    5454    # x * set_unsafe
  • sage/matrix/matrix_generic_sparse.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/matrix/matrix_generic_sparse.pyx
    a b  
    7373    """
    7474    ########################################################################
    7575    # LEVEL 1 functionality
    76     #   * __new__ 
     76    #   * __cinit__ 
    7777    #   * __init__     
    7878    #   * __dealloc__   
    7979    #   * set_unsafe
     
    8181    #   * def _pickle
    8282    #   * def _unpickle
    8383    ########################################################################
    84     def __new__(self, parent, entries=0, coerce=True, copy=True):
     84    def __cinit__(self, parent, entries=0, coerce=True, copy=True):
    8585        self._entries = {}  # crucial so that pickling works
    8686   
    8787    def __init__(self, parent, entries=0, coerce=True, copy=True):
  • sage/matrix/matrix_integer_2x2.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/matrix/matrix_integer_2x2.pyx
    a b  
    105105    """
    106106    ########################################################################
    107107    # LEVEL 1 functionality
    108     # x * __new__
     108    # x * __cinit__
    109109    # x * __init__       
    110110    # x * __dealloc__
    111111    # x * set_unsafe
     
    114114    # x * def _unpickle
    115115    ########################################################################
    116116
    117     def __new__(self, parent, entries, coerce, copy):
     117    def __cinit__(self):
    118118        mpz_init(self.a)
    119119        mpz_init(self.b)
    120120        mpz_init(self.c)
  • sage/matrix/matrix_integer_dense.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/matrix/matrix_integer_dense.pyx
    a b  
    171171    """
    172172    ########################################################################
    173173    # LEVEL 1 functionality
    174     # x * __new__ 
     174    # x * __cinit__ 
    175175    # x * __dealloc__   
    176176    # x * __init__     
    177177    # x * set_unsafe
     
    180180    # x * def _unpickle
    181181    ########################################################################
    182182
    183     def __new__(self, parent, entries, coerce, copy):
     183    def __cinit__(self, parent, entries, coerce, copy):
    184184        """
    185185        Create and allocate memory for the matrix. Does not actually
    186186        initialize any of the memory.
  • sage/matrix/matrix_integer_sparse.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/matrix/matrix_integer_sparse.pyx
    a b  
    4444
    4545    ########################################################################
    4646    # LEVEL 1 functionality
    47     #   * __new__ 
     47    #   * __cinit__ 
    4848    #   * __dealloc__   
    4949    #   * __init__     
    5050    #   * set_unsafe
     
    5252    #   * __richcmp__    -- always the same
    5353    #   * __hash__       -- always simple
    5454    ########################################################################
    55     def __new__(self, parent, entries, copy, coerce):
     55    def __cinit__(self, parent, entries, copy, coerce):
    5656        self._initialized = False
    5757        # set the parent, nrows, ncols, etc.
    5858        matrix_sparse.Matrix_sparse.__init__(self, parent)
  • sage/matrix/matrix_mod2_dense.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/matrix/matrix_mod2_dense.pyx
    a b  
    154154    ########################################################################
    155155    # LEVEL 1 functionality
    156156    ########################################################################
    157     def __new__(self, parent, entries, copy, coerce, alloc=True):
     157    def __cinit__(self, parent, entries, copy, coerce, alloc=True):
    158158        """
    159159        Creates a new dense matrix over GF(2).
    160160
  • sage/matrix/matrix_modn_dense.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/matrix/matrix_modn_dense.pyx
    a b  
    173173cdef class Matrix_modn_dense(matrix_dense.Matrix_dense): 
    174174    ########################################################################
    175175    # LEVEL 1 functionality
    176     # x * __new__ 
     176    # x * __cinit__ 
    177177    # x * __dealloc__   
    178178    # x * __init__     
    179179    # x * set_unsafe
    180180    # x * get_unsafe
    181181    # x * __richcmp__    -- always the same
    182182    ########################################################################
    183     def __new__(self, parent, entries, copy, coerce):
     183    def __cinit__(self, parent, entries, copy, coerce):
    184184   
    185185        matrix_dense.Matrix_dense.__init__(self, parent)
    186186
  • sage/matrix/matrix_modn_sparse.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/matrix/matrix_modn_sparse.pyx
    a b  
    121121
    122122    ########################################################################
    123123    # LEVEL 1 functionality
    124     # x * __new__ 
     124    # x * __cinit__ 
    125125    # x * __dealloc__   
    126126    # x * __init__     
    127127    # x * set_unsafe
    128128    # x * get_unsafe
    129129    # x * __richcmp__    -- always the same
    130130    ########################################################################
    131     def __new__(self, parent, entries, copy, coerce):
     131    def __cinit__(self, parent, entries, copy, coerce):
    132132        matrix.Matrix.__init__(self, parent)
    133133
    134134        # allocate memory
  • sage/matrix/matrix_rational_dense.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/matrix/matrix_rational_dense.pyx
    a b  
    105105
    106106    ########################################################################
    107107    # LEVEL 1 functionality
    108     # x * __new__ 
     108    # x * __cinit__ 
    109109    # x * __dealloc__   
    110110    # x * __init__     
    111111    # x * set_unsafe
     
    113113    # x * cdef _pickle
    114114    # x * cdef _unpickle
    115115    ########################################################################
    116     def __new__(self, parent, entries, copy, coerce):
     116    def __cinit__(self, parent, entries, copy, coerce):
    117117        """
    118118        Create and allocate memory for the matrix.
    119119       
  • sage/matrix/matrix_rational_sparse.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/matrix/matrix_rational_sparse.pyx
    a b  
    4848
    4949    ########################################################################
    5050    # LEVEL 1 functionality
    51     #   * __new__ 
     51    #   * __cinit__ 
    5252    #   * __dealloc__   
    5353    #   * __init__     
    5454    #   * set_unsafe
     
    5656    #   * __richcmp__    -- always the same
    5757    #   * __hash__       -- always simple
    5858    ########################################################################
    59     def __new__(self, parent, entries, copy, coerce):
     59    def __cinit__(self, parent, entries, copy, coerce):
    6060        # set the parent, nrows, ncols, etc.
    6161        matrix_sparse.Matrix_sparse.__init__(self, parent)
    6262
  • sage/matrix/matrix_real_double_dense.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/matrix/matrix_real_double_dense.pyx
    a b  
    8989   
    9090    ########################################################################
    9191    # LEVEL 1 functionality
    92     #   * __new__ 
     92    #   * __cinit__ 
    9393    #   * __dealloc__   
    9494    #   * __init__     
    9595    #   * set_unsafe
     
    9797    #   * __richcmp__    -- always the same
    9898    #   * __hash__       -- always simple
    9999    ########################################################################
    100     def __new__(self, parent, entries, copy, coerce):
     100    def __cinit__(self, parent, entries, copy, coerce):
    101101        global numpy
    102102        if numpy is None:
    103103            import numpy
  • sage/modular/modsym/apply.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/modular/modsym/apply.pyx
    a b  
    2222##     return [int(z) for z in h.padded_list(j+1)]
    2323
    2424cdef class Apply:
    25     def __new__(self):
     25    def __cinit__(self):
    2626        fmpz_poly_init(self.f)
    2727        fmpz_poly_init(self.g)
    2828        fmpz_poly_init(self.ff)
  • sage/modules/vector_complex_double_dense.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/modules/vector_complex_double_dense.pyx
    a b  
    5656        sage: v*v
    5757        -21.8696044011 + 40.5663706144*I
    5858    """
    59     def __new__(self, parent, entries, coerce=True, copy=True):
     59    def __cinit__(self, parent, entries, coerce=True, copy=True):
    6060        global numpy
    6161        if numpy is None:
    6262            import numpy
  • sage/modules/vector_double_dense.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/modules/vector_double_dense.pyx
    a b  
    6767        sage: v*v
    6868        30.0
    6969    """
    70     def __new__(self, parent, entries, coerce=True, copy=True):
     70    def __cinit__(self, parent, entries, coerce=True, copy=True):
    7171        """
    7272        Set up a new vector
    7373
  • sage/modules/vector_integer_dense.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/modules/vector_integer_dense.pyx
    a b  
    8080        if self._entries == NULL:
    8181            raise MemoryError
    8282       
    83     def __new__(self, parent=None, x=None, coerce=True,copy=True):
     83    def __cinit__(self, parent=None, x=None, coerce=True,copy=True):
    8484        self._entries = NULL
    8585        self._is_mutable = 1
    8686        if not parent is None:
  • sage/modules/vector_modn_dense.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/modules/vector_modn_dense.pyx
    a b  
    110110        if self._entries == NULL:
    111111            raise MemoryError
    112112       
    113     def __new__(self, parent=None, x=None, coerce=True, copy=True):
     113    def __cinit__(self, parent=None, x=None, coerce=True, copy=True):
    114114        self._entries = NULL
    115115        self._is_mutable = 1
    116116        if not parent is None:
  • sage/modules/vector_rational_dense.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/modules/vector_rational_dense.pyx
    a b  
    8181        if self._entries == NULL:
    8282            raise MemoryError
    8383       
    84     def __new__(self, parent=None, x=None, coerce=True,copy=True):
     84    def __cinit__(self, parent=None, x=None, coerce=True,copy=True):
    8585        self._entries = NULL
    8686        self._is_mutable = 1
    8787        if not parent is None:
  • sage/modules/vector_real_double_dense.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/modules/vector_real_double_dense.pyx
    a b  
    4646        sage: v*v
    4747        30.0
    4848    """
    49     def __new__(self, parent, entries, coerce=True, copy=True):
     49    def __cinit__(self, parent, entries, coerce=True, copy=True):
    5050        global numpy
    5151        if numpy is None:
    5252            import numpy
  • sage/plot/plot3d/index_face_set.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/plot/plot3d/index_face_set.pyx
    a b  
    177177        sage: S.show()
    178178    """
    179179
    180     def __new__(self):
     180    def __cinit__(self):
    181181        self.vs = <point_c *>NULL
    182182        self.face_indices = <int *>NULL
    183183        self._faces = <face_c *>NULL
  • sage/rings/complex_double.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/rings/complex_double.pyx
    a b  
    591591   
    592592    __array_interface__ = {'typestr': '=c16'}
    593593   
    594     def __new__(self, real=None, imag=None):
     594    def __cinit__(self):
    595595        self._parent = _CDF
    596596       
    597597    def __init__(self, real, imag):
  • sage/rings/finite_field_ntl_gf2e.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/rings/finite_field_ntl_gf2e.pyx
    a b  
    179179        self._one_element = self._new()
    180180        GF2E_conv_long((<FiniteField_ntl_gf2eElement>self._one_element).x,1)
    181181
    182     def __new__(FiniteField_ntl_gf2e self, q, names="a",  modulus=None, repr="poly"):
     182    def __cinit__(FiniteField_ntl_gf2e self, q, names="a",  modulus=None, repr="poly"):
    183183        cdef GF2X_c ntl_m
    184184        cdef GF2_c c
    185185        cdef GF2X_c ntl_tmp
     
    708708        if parent is None:
    709709            raise ValueError, "You must provide a parent to construct a finite field element"
    710710       
    711     def __new__(FiniteField_ntl_gf2eElement self, parent=None ):
     711    def __cinit__(FiniteField_ntl_gf2eElement self, parent=None ):
    712712        if parent is None:
    713713            return
    714714        if PY_TYPE_CHECK(parent, FiniteField_ntl_gf2e):
  • sage/rings/integer.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/rings/integer.pyx
    a b  
    392392        10
    393393    """
    394394
    395     # todo: It would be really nice if we could avoid the __new__ call.
    396     # It has python calling conventions, and our timing tests indicate the
    397     # overhead can be significant. The difficulty is that then we can't
    398     # guarantee that the initialization will be performed exactly once.
    399 
    400     def __cinit__(self, x=None, unsigned int base=0):
     395    def __cinit__(self):
    401396        mpz_init(self.value)
    402397        self._parent = <SageObject>the_integer_ring
    403398       
  • sage/rings/number_field/number_field_element.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/rings/number_field/number_field_element.pyx
    a b  
    313313            (<Integer>ZZ(num[i]))._to_ZZ(&coeff)
    314314            ZZX_SetCoeff( self.__numerator, i, coeff )
    315315
    316     def __new__(self, parent = None, f = None):
     316    def __cinit__(self):
    317317        ZZX_construct(&self.__numerator)
    318318        ZZ_construct(&self.__denominator)
    319319
  • sage/rings/number_field/number_field_element_quadratic.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/rings/number_field/number_field_element_quadratic.pyx
    a b  
    281281        return x
    282282       
    283283
    284     def __new__(self, parent=None, f=None):
     284    def __cinit__(self):
    285285        mpz_init(self.a)
    286286        mpz_init(self.b)
    287287        mpz_init(self.denom)
  • sage/rings/padics/pow_computer.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/rings/padics/pow_computer.pyx
    a b  
    4242cdef long maxpreccap = (1L << (sizeof(long) * 8 - 2)) - 1
    4343
    4444cdef class PowComputer_class(SageObject):
    45     def __new__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly=None, shift_seed=None):
     45    def __cinit__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly=None, shift_seed=None):
    4646        """
    4747        Creates a new PowComputer_class.
    4848
     
    410410            return self.pow_Integer(mpz_get_ui(_n.value))
    411411
    412412cdef class PowComputer_base(PowComputer_class):
    413     def __new__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly=None, shift_seed=None):
     413    def __cinit__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly=None, shift_seed=None):
    414414        """
    415415        Initializes a PowComputer_base.
    416416
  • sage/rings/padics/pow_computer_ext.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/rings/padics/pow_computer_ext.pyx
    a b  
    483483    ZZ_pX_conv_modulus(x[0], working2, c.x)
    484484
    485485cdef class PowComputer_ext(PowComputer_class):
    486     def __new__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly, shift_seed=None):
     486    def __cinit__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly, shift_seed=None):
    487487        """
    488488        Constructs the storage for powers of prime as ZZ_c's.
    489489
     
    781781        return self.ram_prec_cap
    782782
    783783cdef class PowComputer_ZZ_pX(PowComputer_ext):
    784     def __new__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly, shift_seed = None):
     784    def __cinit__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly, shift_seed = None):
    785785        if not PY_TYPE_CHECK(poly, ntl_ZZ_pX):
    786786            raise TypeError
    787787        self.deg = ZZ_pX_deg((<ntl_ZZ_pX>poly).x)
     
    12601260    and unramified extensions of $\mathbb{Z}_p$.
    12611261    """
    12621262
    1263     def __new__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly, shift_seed = None):
     1263    def __cinit__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly, shift_seed = None):
    12641264        """
    12651265        Caches a context and modulus for prime^prec_cap
    12661266
     
    13781378    This class computes and stores low_shifter and high_shifter, which aid in right shifting elements.
    13791379    """
    13801380
    1381     def __new__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly, shift_seed = None):
     1381    def __cinit__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly, shift_seed = None):
    13821382        """
    13831383        Calls Eis_init, which initializes high_shifter and low_shifter.
    13841384
     
    16271627    extensions of the base p-adic fields.
    16281628    """
    16291629
    1630     def __new__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly, shift_seed = None):
     1630    def __cinit__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly, shift_seed = None):
    16311631        """
    16321632        Caches contexts and moduli densely between 1 and cache_limit.
    16331633
     
    18381838    This class computes and stores low_shifter and high_shifter, which aid in right shifting elements.
    18391839    These are only stored at maximal precision: in order to get lower precision versions just reduce mod p^n.
    18401840    """
    1841     def __new__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly, shift_seed = None):
     1841    def __cinit__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly, shift_seed = None):
    18421842        self._ext_type = 'e'
    18431843        if not PY_TYPE_CHECK(shift_seed, ntl_ZZ_pX):
    18441844            raise TypeError, "shift_seed must be an ntl_ZZ_pX"
     
    19901990    a dictionary of contexts and moduli of
    19911991    """
    19921992
    1993     def __new__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly, shift_seed = None):
     1993    def __cinit__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly, shift_seed = None):
    19941994        """
    19951995        Caches contexts and moduli densely between 1 and cache_limit.  Caches a context and modulus for prec_cap.
    19961996        Also creates the dictionaries.
     
    22682268    This class computes and stores low_shifter and high_shifter, which aid in right shifting elements.
    22692269    These are only stored at maximal precision: in order to get lower precision versions just reduce mod p^n.
    22702270    """
    2271     def __new__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly, shift_seed = None):
     2271    def __cinit__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly, shift_seed = None):
    22722272        self._ext_type = 'e'
    22732273        if not PY_TYPE_CHECK(shift_seed, ntl_ZZ_pX):
    22742274            raise TypeError, "shift_seed must be an ntl_ZZ_pX"
  • sage/rings/polynomial/polydict.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/rings/polynomial/polydict.pyx
    a b  
    947947        else:
    948948            raise TypeError
    949949
    950     def __new__(ETuple self, data=None, length=None):
     950    def __cinit__(ETuple self):
    951951        self._data = <int*>0
    952952
    953953    def __dealloc__(self):
  • sage/rings/polynomial/polynomial_integer_dense_flint.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/rings/polynomial/polynomial_integer_dense_flint.pyx
    a b  
    5454    A dense polynomial over the integers, implemented via FLINT.
    5555    """
    5656
    57     def __new__(self, parent=None, x=None, check=True, is_gen=False,
    58             construct=False):
     57    def __cinit__(self):
    5958        r"""
    6059        This calls the underlying FLINT fmpz_poly constructor
    6160        """
  • sage/rings/polynomial/polynomial_integer_dense_ntl.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/rings/polynomial/polynomial_integer_dense_ntl.pyx
    a b  
    6363    A dense polynomial over the integers, implemented via NTL.
    6464    """
    6565
    66     def __new__(self, parent=None, x=None, check=True, is_gen=False, construct=False):
     66    def __cinit__(self):
    6767        r"""
    6868        This calls the underlying NTL constructor.
    6969        """
  • sage/rings/rational.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/rings/rational.pyx
    a b  
    316316        sage: Rational(pari('-939082/3992923'))
    317317        -939082/3992923
    318318    """
    319     def __new__(self, x=None, int base=0):
     319    def __cinit__(self):
    320320        global the_rational_ring
    321321        mpq_init(self.value)
    322322        self._parent = the_rational_ring
  • sage/rings/real_double.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/rings/real_double.pyx
    a b  
    523523   
    524524    __array_interface__ = {'typestr': '=f8'}
    525525   
    526     def __new__(self, x=None):
     526    def __cinit__(self):
    527527        (<Element>self)._parent = _RDF
    528528       
    529529    def __init__(self, x):
  • sage/rings/real_rqdf.pyx

    diff -r 684eea91ff22 -r 5cf13bf8083a sage/rings/real_rqdf.pyx
    a b  
    439439        fpu_fix_end(&cw)
    440440        pass
    441441       
    442     def __new__(self, x=None):
     442    def __cinit__(self, x=None):
    443443        # explicit cast required for C++
    444444        self._parent = <ParentWithBase> _RQDF 
    445445        from sage.misc.misc import deprecation