Files
python-netCDF4/1322.patch
Dirk Mueller e0ccfc46a3 - update to 1.7.2:
* add static type hints (PRs #1302, #1349)
  * Expose nc_rc_set, nc_rc_get (via rc_set, rc_get module
    functions). (PR #1348)
  * Add Variable.get_fill_value and allow `fill_value='default'`
    to set `_FillValue` attribute using default fill values.
  * Fix NETCDF3 endian error (issue #1373, PR #1355).

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-netCDF4?expand=0&rev=49
2025-05-05 20:59:26 +00:00

46 lines
2.2 KiB
Diff

From ea590c2f94b1ce93e6873cf712beb0e3d92b4e9b Mon Sep 17 00:00:00 2001
From: Orion Poplawski <orion@nwra.com>
Date: Wed, 8 May 2024 20:50:22 -0600
Subject: [PATCH] Fix incompatbile pointer argument to nc_put_att_string()
---
include/netCDF4.pxi | 2 +-
src/netCDF4/_netCDF4.pyx | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/netCDF4.pxi b/include/netCDF4.pxi
index 00d883662..9404171db 100644
--- a/include/netCDF4.pxi
+++ b/include/netCDF4.pxi
@@ -263,7 +263,7 @@ cdef extern from "netcdf.h":
size_t len, void *op) nogil
int nc_get_att(int ncid, int varid, char *name, void *ip) nogil
int nc_get_att_string(int ncid, int varid, char *name, char **ip) nogil
- int nc_put_att_string(int ncid, int varid, char *name, size_t len, char **op) nogil
+ int nc_put_att_string(int ncid, int varid, char *name, size_t len, const char **op) nogil
int nc_def_opaque(int ncid, size_t size, char *name, nc_type *xtypep) nogil
int nc_inq_opaque(int ncid, nc_type xtype, char *name, size_t *sizep) nogil
int nc_put_att_opaque(int ncid, int varid, char *name,
diff --git a/src/netCDF4/_netCDF4.pyx b/src/netCDF4/_netCDF4.pyx
index 640ab6846..b957f4e35 100644
--- a/src/netCDF4/_netCDF4.pyx
+++ b/src/netCDF4/_netCDF4.pyx
@@ -1796,7 +1796,7 @@ be raised in the next release."""
string_ptrs[j] = strings[j]
issue485_workaround(grpid, varid, attname)
with nogil:
- ierr = nc_put_att_string(grpid, varid, attname, N, string_ptrs)
+ ierr = nc_put_att_string(grpid, varid, attname, N, <const char**>string_ptrs)
finally:
PyMem_Free(string_ptrs)
else:
@@ -1825,7 +1825,7 @@ be raised in the next release."""
except UnicodeError:
issue485_workaround(grpid, varid, attname)
with nogil:
- ierr = nc_put_att_string(grpid, varid, attname, 1, &datstring)
+ ierr = nc_put_att_string(grpid, varid, attname, 1, <const char**>&datstring)
else:
with nogil:
ierr = nc_put_att_text(grpid, varid, attname, lenarr, datstring)