From c0130d32b7c1e32f401f341eb705eca08e19c43a Mon Sep 17 00:00:00 2001 From: Casey Brooks Date: Thu, 18 Dec 2025 14:50:44 +0000 Subject: [PATCH 1/2] fix(table): keep structured arrays as columns [ci skip] --- astropy/table/table.py | 7 -- astropy/table/tests/test_mixin.py | 121 +++++++++++++++++++++--------- 2 files changed, 87 insertions(+), 41 deletions(-) diff --git a/astropy/table/table.py b/astropy/table/table.py index 5afe2127a379..88830f5a2f43 100644 --- a/astropy/table/table.py +++ b/astropy/table/table.py @@ -1239,13 +1239,6 @@ def _convert_data_to_col(self, data, copy=True, default_name=None, dtype=None, n f'{fully_qualified_name} ' 'did not return a valid mixin column') - # Structured ndarray gets viewed as a mixin unless already a valid - # mixin class - if (not isinstance(data, Column) and not data_is_mixin - and isinstance(data, np.ndarray) and len(data.dtype) > 1): - data = data.view(NdarrayMixin) - data_is_mixin = True - # Get the final column name using precedence. Some objects may not # have an info attribute. Also avoid creating info as a side effect. if not name: diff --git a/astropy/table/tests/test_mixin.py b/astropy/table/tests/test_mixin.py index 2fdcd20d8fdf..e0c603555100 100644 --- a/astropy/table/tests/test_mixin.py +++ b/astropy/table/tests/test_mixin.py @@ -698,11 +698,8 @@ def test_skycoord_representation(): def test_ndarray_mixin(): - """ - Test directly adding a plain structured array into a table instead of the - view as an NdarrayMixin. Once added as an NdarrayMixin then all the previous - tests apply. - """ + """Structured ndarrays become plain Columns unless explicitly viewed.""" + a = np.array([(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd')], dtype=' Date: Sun, 11 Jan 2026 18:46:15 +0000 Subject: [PATCH 2/2] fix(build): support cython on py312 --- cextern/cfitsio/lib/putcol.c | 12 ++++++------ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cextern/cfitsio/lib/putcol.c b/cextern/cfitsio/lib/putcol.c index 7808233421ab..c2a4f3f2be1b 100644 --- a/cextern/cfitsio/lib/putcol.c +++ b/cextern/cfitsio/lib/putcol.c @@ -1111,7 +1111,7 @@ int ffiter(int n_cols, long rept, rowrept, width, tnull, naxes[9] = {1,1,1,1,1,1,1,1,1}, groups; double zeros = 0.; char message[FLEN_ERRMSG], keyname[FLEN_KEYWORD], nullstr[FLEN_VALUE]; - char **stringptr, *nullptr, *cptr; + char **stringptr, *null_ptr, *cptr; if (*status > 0) return(*status); @@ -1885,24 +1885,24 @@ int ffiter(int n_cols, { stringptr = cols[jj].array; dataptr = stringptr + 1; - nullptr = *stringptr; + null_ptr = *stringptr; nbytes = 2; } else { dataptr = (char *) cols[jj].array + col[jj].nullsize; - nullptr = (char *) cols[jj].array; + null_ptr = (char *) cols[jj].array; nbytes = col[jj].nullsize; } - if (memcmp(nullptr, &zeros, nbytes) ) + if (memcmp(null_ptr, &zeros, nbytes) ) { /* null value flag not zero; must check for and write nulls */ if (hdutype == IMAGE_HDU) { if (ffppn(cols[jj].fptr, cols[jj].datatype, felement, cols[jj].repeat * ntodo, dataptr, - nullptr, &tstatus) > 0) + null_ptr, &tstatus) > 0) break; } else @@ -1917,7 +1917,7 @@ int ffiter(int n_cols, if (ffpcn(cols[jj].fptr, cols[jj].datatype, cols[jj].colnum, frow, felement, cols[jj].repeat * ntodo, dataptr, - nullptr, &tstatus) > 0) + null_ptr, &tstatus) > 0) break; } } diff --git a/pyproject.toml b/pyproject.toml index 4e84dd196bfc..8dd02b108c82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ requires = ["setuptools", "setuptools_scm>=6.2", "wheel", - "cython==0.29.22", + "cython>=0.29.37,<0.30", "oldest-supported-numpy", "extension-helpers"] build-backend = 'setuptools.build_meta'