From 4624c58335ac51bffce45f920b339d77bf1f31e7 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Fri, 20 Feb 2026 14:31:45 -0800 Subject: [PATCH 1/2] Modify numpy.ndarray class definition to ignore check_size Addressing: Numpy binary incompatibility warning #1354 This is using the same declaration that numpy is currently using. --- include/netCDF4.pxi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/netCDF4.pxi b/include/netCDF4.pxi index 62b9be609..489b90f02 100644 --- a/include/netCDF4.pxi +++ b/include/netCDF4.pxi @@ -373,9 +373,9 @@ cdef extern from "mpi-compat.h": # taken from numpy.pxi in numpy 1.0rc2. cdef extern from "numpy/arrayobject.h": ctypedef int npy_intp - ctypedef extern class numpy.ndarray [object PyArrayObject]: + ctypedef extern class numpy.ndarray [object PyArrayObject, check_size ignore]: pass - npy_intp PyArray_SIZE(ndarray arr) nogil + npy_intp PyArray_SIZE(ndarray arr) nogil npy_intp PyArray_ISCONTIGUOUS(ndarray arr) nogil npy_intp PyArray_ISALIGNED(ndarray arr) nogil void* PyArray_DATA(ndarray) nogil From cf9a745f30c70224263f008fa83f9046c3784047 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Fri, 20 Feb 2026 14:37:02 -0800 Subject: [PATCH 2/2] Fix indentation for PyArray_SIZE function declaration --- include/netCDF4.pxi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/netCDF4.pxi b/include/netCDF4.pxi index 489b90f02..d1d398ee0 100644 --- a/include/netCDF4.pxi +++ b/include/netCDF4.pxi @@ -375,7 +375,7 @@ cdef extern from "numpy/arrayobject.h": ctypedef int npy_intp ctypedef extern class numpy.ndarray [object PyArrayObject, check_size ignore]: pass - npy_intp PyArray_SIZE(ndarray arr) nogil + npy_intp PyArray_SIZE(ndarray arr) nogil npy_intp PyArray_ISCONTIGUOUS(ndarray arr) nogil npy_intp PyArray_ISALIGNED(ndarray arr) nogil void* PyArray_DATA(ndarray) nogil