[Numpy-svn] r4908 - trunk/numpy/core/tests
numpy-svn at scipy.org
numpy-svn at scipy.org
Fri Mar 21 20:10:15 EDT 2008
Author: oliphant
Date: 2008-03-21 19:10:11 -0500 (Fri, 21 Mar 2008)
New Revision: 4908
Modified:
trunk/numpy/core/tests/test_regression.py
Log:
Add regression test in Ticket #711 which is the fix by pv
Modified: trunk/numpy/core/tests/test_regression.py
===================================================================
--- trunk/numpy/core/tests/test_regression.py 2008-03-21 23:54:58 UTC (rev 4907)
+++ trunk/numpy/core/tests/test_regression.py 2008-03-22 00:10:11 UTC (rev 4908)
@@ -924,6 +924,21 @@
arr3 = x.choose(arr1, arr2)
assert cnt(a) == cnt0_a + 5 + 2
assert cnt(b) == cnt0_b + 5 + 3
+
+ def check_object_array_refcount_self_assign(self):
+ """Ticket #711"""
+ class VictimObject(object):
+ deleted = False
+ def __del__(self):
+ self.deleted = True
+ d = VictimObject()
+ arr = np.zeros(5, dtype=np.object_)
+ arr[:] = d
+ del d
+ arr[:] = arr # refcount of 'd' might hit zero here
+ assert not arr[0].deleted
+ arr[:] = arr # trying to induce a segfault by doing it again...
+ assert not arr[0].deleted
if __name__ == "__main__":
NumpyTest().run()
More information about the Numpy-svn
mailing list