File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ cdef extern from *:
5555 """
5656
5757cdef extern from " flint/flint.h" :
58+ # These defines are needed to work around a Cython bug.
59+ # Otherwise sizeof(ulong) will give the wrong size on 64 bit Windows.
60+ # https://github.com/cython/cython/issues/6339
5861 """
5962 #define SIZEOF_ULONG sizeof(ulong)
6063 #define SIZEOF_SLONG sizeof(slong)
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ from flint.types.fmpq cimport any_as_fmpq
99cimport cython
1010cimport libc.stdlib
1111
12+ from flint.flintlib.types.flint cimport SIZEOF_SLONG
13+
1214from flint.flintlib.functions.fmpz cimport (
1315 fmpz_set,
1416 fmpz_init,
@@ -660,7 +662,7 @@ cdef class fmpz_mat(flint_mat):
660662 cdef fmpz_mat LU
661663 r = fmpz_mat_nrows(self .val)
662664 c = fmpz_mat_ncols(self .val)
663- perm = < slong* > libc.stdlib.malloc(r * sizeof(slong) )
665+ perm = < slong* > libc.stdlib.malloc(r * SIZEOF_SLONG )
664666 if perm is NULL :
665667 raise MemoryError (" malloc failed" )
666668 try :
You can’t perform that action at this time.
0 commit comments