Skip to content

Bottleneck bug with unusual strides - causes segfault or wrong number #5424

Description

@lusewell
import numpy as np
import xarray as xr
data = np.zeros((1,500, 2)).transpose(1,2,0)
xarr = xr.DataArray(data, coords=[('A', range(500)), ('B', [0,1]), ('C', [0])])
xarr.max()                                  

The above either returns a very large non-zero number or segfaults. Due to pydata/bottleneck#381.

Dual posting here in case this isn't able to get quickly fixed in bottleneck, as this is a pretty severe bug - especially on the occaions it returns the wrong number rather than segfaulting.

Environment:

INSTALLED VERSIONS
------------------
commit: None
python: 3.7.7 (default, Mar 26 2020, 15:48:22) 
[GCC 7.3.0]
python-bits: 64
OS: Linux
OS-release: 3.10.0-1160.21.1.el7.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
libhdf5: 1.10.4
libnetcdf: None

xarray: 0.14.1
pandas: 0.25.0
numpy: 1.16.6
scipy: 1.4.1
netCDF4: None
pydap: None
h5netcdf: None
h5py: 2.10.0
Nio: None
zarr: None
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: 1.3.2
dask: 2.10.1
distributed: 2.10.0
matplotlib: 3.1.3
cartopy: None
seaborn: 0.10.0
numbagg: installed
setuptools: 46.1.3.post20200330
pip: 20.0.2
conda: None
pytest: 5.2.4
IPython: 7.20.0
sphinx: 2.4.4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions