File tree 1 file changed +12
-4
lines changed 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -6522,12 +6522,20 @@ def test_max_dims(self):
6522
6522
a = np .empty ((1 ,) * 32 )
6523
6523
self ._check_roundtrip (a )
6524
6524
6525
+ def _make_ctype (shape , scalar_type ):
6526
+ t = scalar_type
6527
+ for dim in shape [::- 1 ]:
6528
+ t = dim * t
6529
+ return t
6530
+
6531
+ # This creates deeply nested reference cycles that cause
6532
+ # np.lib.tests.test_io.test_load_refcount to erroneously fail (gh-10891).
6533
+ # Not making it a local ensure that the GC doesn't touch it during the tests
6534
+ c_u8_33d = _make_ctype ((1 ,)* 33 , ctypes .c_uint8 )
6535
+
6525
6536
def test_error_too_many_dims (self ):
6526
6537
# construct a memoryview with 33 dimensions
6527
- ct = ctypes .c_uint8
6528
- for i in range (33 ):
6529
- ct = 1 * ct
6530
- m = memoryview (ct ())
6538
+ m = memoryview (self .c_u8_33d ())
6531
6539
assert_equal (m .ndim , 33 )
6532
6540
6533
6541
assert_raises_regex (
You can’t perform that action at this time.
0 commit comments