Skip to content

Commit b1f9148

Browse files
committed
Fix build warning: uninitialized variable xtype
src/pnetcdf/_Variable.c: In function '__pyx_pw_7pnetcdf_9_Variable_8Variable_1__init__': src/pnetcdf/_Variable.c:10050:11: warning: '__pyx_v_xtype' may be used uninitialized in this function [-Wmaybe-uninitialized] nc_type __pyx_v_xtype; ^~~~~~~~~~~~~
1 parent c54d0b0 commit b1f9148

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/pnetcdf/_Variable.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ cdef class Variable:
111111
xtype = _nptonctype[nc_dtype.str[1:]]
112112
else:
113113
raise TypeError('illegal data type, must be one of %s, got %s' % (_supportedtypes, nc_dtype.str[1:]))
114-
if isinstance(nc_dtype, int):
114+
elif isinstance(nc_dtype, int):
115115
xtype = nc_dtype
116+
else:
117+
raise TypeError('illegal data type, must be an int, got %s' % (nc_dtype.str[1:]))
116118
self.xtype = xtype
117119
self.dtype = np.dtype(_nctonptype[xtype])
118120

0 commit comments

Comments
 (0)