Commit 178b8e30 authored by Stefan Behnel's avatar Stefan Behnel

Avoid memory leak in NumPy test.

parent f3b71348
...@@ -7,7 +7,6 @@ cimport cython ...@@ -7,7 +7,6 @@ cimport cython
import re import re
import sys import sys
from libc.stdlib cimport malloc
def little_endian(): def little_endian():
cdef int endian_detector = 1 cdef int endian_detector = 1
...@@ -657,9 +656,11 @@ cdef fused fused_ndarray: ...@@ -657,9 +656,11 @@ cdef fused fused_ndarray:
np.ndarray[Foo, ndim=1] np.ndarray[Foo, ndim=1]
def get_Foo_array(): def get_Foo_array():
cdef Foo[:] result = <Foo[:10]> malloc(sizeof(Foo) * 10) cdef Foo data[10]
result[5].b = 9.0 for i in range(10):
return np.asarray(result) data[i] = [0, 0]
data[5].b = 9.0
return np.asarray(<Foo[:]>data).copy()
@testcase_have_buffer_interface @testcase_have_buffer_interface
def test_fused_ndarray(fused_ndarray a): def test_fused_ndarray(fused_ndarray a):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment