Skip to content

Commit

Permalink
Merge pull request #1322 from opoplawski/incompatible-pointer
Browse files Browse the repository at this point in the history
Fix incompatbile pointer argument to nc_put_att_string()
  • Loading branch information
jswhit committed May 9, 2024
2 parents a3766f4 + ea590c2 commit 49dcd0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/netCDF4.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/netCDF4/_netCDF4.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 49dcd0b

Please sign in to comment.