From 9fe3554b33ed1c3e7c8c78a8ac97322c0a16f7cb Mon Sep 17 00:00:00 2001 From: Tyler Reddy Date: Fri, 3 Mar 2023 13:06:38 -0700 Subject: BUG: ma with structured dtype Fixes #22041 * add regression test and fix for creating a masked array with a structured dtype; the test is simply for lack of error in the repoducer * the concern expressed by core team in matching issue was that `astropy` might be negatively affected; I ran full `astropy` (hash: `c9ad7c56`) test suite locally with this feature branch and it seemed "ok," just 1 unrelated network failure in the network-requiring tests (`test_ftp_tls_auto`): ```1 failed, 21430 passed, 3490 skipped, 176 xfailed, 23275 warnings in 430.18s (0:07:10)``` --- numpy/ma/tests/test_regression.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'numpy/ma/tests/test_regression.py') diff --git a/numpy/ma/tests/test_regression.py b/numpy/ma/tests/test_regression.py index cb3d0349f..f4f32cc7a 100644 --- a/numpy/ma/tests/test_regression.py +++ b/numpy/ma/tests/test_regression.py @@ -89,3 +89,9 @@ class TestRegression: def test_masked_array_tobytes_fortran(self): ma = np.ma.arange(4).reshape((2,2)) assert_array_equal(ma.tobytes(order='F'), ma.T.tobytes()) + + def test_structured_array(self): + # see gh-22041 + np.ma.array((1, (b"", b"")), + dtype=[("x", np.int_), + ("y", [("i", np.void), ("j", np.void)])]) -- cgit v1.2.1