Skip to content

Commit c54d0b0

Browse files
committed
fix build warning: use of numpy import_array()
src/pnetcdf/_utils.c: In function '__pyx_pymod_exec__utils': src/pnetcdf/_utils.c:17646:3: warning: returning 'void *' from a function with return type 'int' makes integer from pointer without a cast [-Wint-conversion] import_array(); ^~~~~~~~~~~~ src/pnetcdf/_Variable.c: In function '__pyx_pymod_exec__Variable': src/pnetcdf/_Variable.c:77507:3: warning: returning 'void *' from a function with return type 'int' makes integer from pointer without a cast [-Wint-conversion] import_array(); ^~~~~~~~~~~~
1 parent 69de124 commit c54d0b0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/pnetcdf/_Variable.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ from ._utils cimport _strencode, _check_err, _set_att, _get_att, _get_att_names,
2323
from ._utils import chartostring
2424
from ._utils cimport _nptonctype, _notcdf2dtypes, _nctonptype, _nptompitype, _supportedtypes, _supportedtypescdf2, \
2525
default_fillvals, _StartCountStride, _out_array_shape, _private_atts
26-
import_array()
26+
27+
cimport numpy
28+
numpy.import_array()
2729

2830

2931
ctypedef MPI.Datatype Datatype

src/pnetcdf/_utils.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ MPI_Datatype MPI_UNSIGNED64 = MPI.UINT64
2828
MPI_Datatype MPI_FLOAT = MPI.FLOAT
2929
MPI_Datatype MPI_DOUBLE = MPI.DOUBLE"""
3030

31-
import_array()
31+
cimport numpy
32+
numpy.import_array()
3233

3334
# np data type <--> netCDF data type mapping.
3435
_nptonctype = {'S1' : NC_CHAR_C,

0 commit comments

Comments
 (0)