diff --git a/base/PyNucleus_base/blas.pyx b/base/PyNucleus_base/blas.pyx index 57dde27..d339a2f 100644 --- a/base/PyNucleus_base/blas.pyx +++ b/base/PyNucleus_base/blas.pyx @@ -41,7 +41,7 @@ def uninitialized_like(like, **kwargs): cpdef carray uninitializedINDEX(tuple shape): cdef: carray a = carray(shape, 4, 'i') - size_t s, i + Py_ssize_t s, i IF FILL_UNINITIALIZED: s = 1 for i in range(len(shape)): @@ -54,7 +54,7 @@ cpdef carray uninitializedINDEX(tuple shape): cpdef carray uninitializedREAL(tuple shape): cdef: carray a = carray(shape, 8, 'd') - size_t s, i + Py_ssize_t s, i IF FILL_UNINITIALIZED: s = 1 for i in range(len(shape)): diff --git a/base/PyNucleus_base/tupleDict.pxd b/base/PyNucleus_base/tupleDict.pxd index 8287826..4952b31 100644 --- a/base/PyNucleus_base/tupleDict.pxd +++ b/base/PyNucleus_base/tupleDict.pxd @@ -72,4 +72,5 @@ cdef class bitArray(indexSet): cdef class bitArrayIterator(indexSetIterator): cdef: bitArray bA - INDEX_t k, n + INDEX_t k + size_t n diff --git a/base/PyNucleus_base/tupleDict.pyx b/base/PyNucleus_base/tupleDict.pyx index 5bd2ca4..a10e47c 100644 --- a/base/PyNucleus_base/tupleDict.pyx +++ b/base/PyNucleus_base/tupleDict.pyx @@ -451,7 +451,7 @@ cdef class arrayIndexSetIterator(indexSetIterator): cdef class bitArray(indexSet): - def __init__(self, INDEX_t hintMaxLength=1, INDEX_t maxElement=0): + def __init__(self, size_t hintMaxLength=1, INDEX_t maxElement=0): self.length = max(hintMaxLength, maxElement/(sizeof(MEM_t)*8)+1) self.a = malloc(self.length*sizeof(MEM_t)) for j in range(self.length): @@ -562,7 +562,8 @@ cdef class bitArrayIterator(indexSetIterator): cdef BOOL_t step(self): cdef: bitArray bA = self.iS - INDEX_t k0, n0, k, n + INDEX_t k0, k + size_t n0, n MEM_t v if self.n == sizeof(MEM_t)*8-1: diff --git a/nl/PyNucleus_nl/nonlocalAssembly.pyx b/nl/PyNucleus_nl/nonlocalAssembly.pyx index e684c8f..7d776d6 100644 --- a/nl/PyNucleus_nl/nonlocalAssembly.pyx +++ b/nl/PyNucleus_nl/nonlocalAssembly.pyx @@ -13,6 +13,7 @@ include "config.pxi" from libc.math cimport sin, cos, M_PI as pi from libcpp.map cimport map +from cpython.long cimport PyLong_FromSsize_t from PyNucleus_base.myTypes import INDEX, REAL, COMPLEX, ENCODE, BOOL from PyNucleus_base import uninitialized from PyNucleus_base.intTuple cimport intTuple diff --git a/nl/PyNucleus_nl/nonlocalAssembly_{SCALAR}.pxi b/nl/PyNucleus_nl/nonlocalAssembly_{SCALAR}.pxi index 9fe0389..cc3e030 100644 --- a/nl/PyNucleus_nl/nonlocalAssembly_{SCALAR}.pxi +++ b/nl/PyNucleus_nl/nonlocalAssembly_{SCALAR}.pxi @@ -714,7 +714,7 @@ cdef class {SCALAR_label}nonlocalBuilder: self.contrib = uninitialized(((2*self.dm.dofs_per_element)*(2*self.dm.dofs_per_element+1)//2), dtype={SCALAR}) else: self.contrib = uninitialized(((2*self.dm.dofs_per_element)**2), dtype={SCALAR}) - assert self.contrib.shape[0] <= mask.size(), "Mask type size = {} is not large enough for {} entries. Please set a larger size and recompile.".format(mask.size(), self.contrib.shape[0]) + assert self.contrib.shape[0] <= PyLong_FromSsize_t(mask.size()), "Mask type size = {} is not large enough for {} entries. Please set a larger size and recompile.".format(mask.size(), self.contrib.shape[0]) self.local_matrix.setMesh1(self.dm.mesh) if self.dm2 is None: