diff --git a/netCDF4/_netCDF4.pyx b/netCDF4/_netCDF4.pyx index 28b2c605c..107eb6e25 100644 --- a/netCDF4/_netCDF4.pyx +++ b/netCDF4/_netCDF4.pyx @@ -4581,7 +4581,7 @@ rename a `netCDF4.Variable` attribute named `oldname` to `newname`.""" # type, signed or unsigned, because the byte ranges are too # small to assume one of the values should appear as a missing # value unless a _FillValue attribute is set explicitly." - if no_fill != 1 and self.dtype.str[1:] not in ['u1','i1']: + if no_fill != 1 or self.dtype.str[1:] not in ['u1','i1']: fillval = numpy.array(default_fillvals[self.dtype.str[1:]],self.dtype) has_fillval = data == fillval # if data is an array scalar, has_fillval will be a boolean.