Skip to content

Commit 46ff10f

Browse files
committed
#39312: remove yet another dealloc
1 parent fa64c38 commit 46ff10f

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/sage/coding/binary_code.pyx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,9 +1291,6 @@ cdef class OrbitPartition:
12911291
self.col_min_cell_rep[col] = col
12921292
self.col_size[col] = 1
12931293

1294-
def __dealloc__(self):
1295-
pass
1296-
12971294
def __repr__(self):
12981295
"""
12991296
Return a string representation of the orbit partition.
@@ -2976,17 +2973,12 @@ cdef class PartitionStack:
29762973
([0, 1, 2, 3, 4, 5, 6, 7, 12, 13, 14, 15, 8, 9, 10, 11], [0, 1, 2, 3, 5, 4, 7, 6])
29772974
"""
29782975
cdef int i
2979-
cdef int *word_g = <int *> sig_malloc( self.nwords * sizeof(int) )
2980-
cdef int *col_g = <int *> sig_malloc( self.ncols * sizeof(int) )
2981-
if word_g is NULL or col_g is NULL:
2982-
if word_g is not NULL: sig_free(word_g)
2983-
if col_g is not NULL: sig_free(col_g)
2984-
raise MemoryError("Memory.")
2976+
cdef MemoryAllocator loc_mem = MemoryAllocator()
2977+
cdef int *word_g = <int *> loc_mem.malloc(self.nwords * sizeof(int))
2978+
cdef int *col_g = <int *> loc_mem.malloc(self.ncols * sizeof(int))
29852979
self.get_permutation(other, word_g, col_g)
29862980
word_l = [word_g[i] for i from 0 <= i < self.nwords]
29872981
col_l = [col_g[i] for i from 0 <= i < self.ncols]
2988-
sig_free(word_g)
2989-
sig_free(col_g)
29902982
return word_l, col_l
29912983

29922984
cdef void get_permutation(self, PartitionStack other, int *word_gamma, int *col_gamma) noexcept:

0 commit comments

Comments
 (0)