diff options
author | Travis E. Oliphant <teoliphant@gmail.com> | 2012-04-11 22:50:50 -0700 |
---|---|---|
committer | Travis E. Oliphant <teoliphant@gmail.com> | 2012-04-11 22:50:50 -0700 |
commit | 0c5f480f2db3566a1add20a2f286e6b7e9608c94 (patch) | |
tree | 6ff5f511b803152627546dc0abdb30f1bb87498e /numpy | |
parent | d50f961849a9a5f694e72329e8565f3c261e64a8 (diff) | |
parent | fc4784a482c83f68f13abe4a54051da25348c005 (diff) | |
download | numpy-0c5f480f2db3566a1add20a2f286e6b7e9608c94.tar.gz |
Merge pull request #250 from charris/fix-debug-crash
BUG: Fix segfault when tests are run with python 2.7 debug.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/na_mask.c | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_regression.py | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/na_mask.c b/numpy/core/src/multiarray/na_mask.c index 0e0e285b6..8fbe8ea60 100644 --- a/numpy/core/src/multiarray/na_mask.c +++ b/numpy/core/src/multiarray/na_mask.c @@ -361,7 +361,7 @@ PyArray_AllocateMaskNA(PyArrayObject *arr, } /* Allocate the mask memory */ - maskna_data = PyArray_malloc(size * maskna_dtype->elsize); + maskna_data = PyDataMem_NEW(size * maskna_dtype->elsize); if (maskna_data == NULL) { Py_DECREF(maskna_dtype); PyErr_NoMemory(); diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py index ac36aa479..7905d38cd 100644 --- a/numpy/core/tests/test_regression.py +++ b/numpy/core/tests/test_regression.py @@ -1692,5 +1692,10 @@ class TestRegression(TestCase): a = np.array(['abc'], dtype=np.unicode)[0] del a + def test_maskna_deallocation(self): + # This caused a segfault when running under python-debug + a = np.array([1]).view(maskna=True) + del a + if __name__ == "__main__": run_module_suite() |