-
Notifications
You must be signed in to change notification settings - Fork 2.2k
array_t constructor takes shape as size_t, not ssize_t #1599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
bstaletic
added a commit
to bstaletic/pybind11
that referenced
this issue
Jul 12, 2020
- `PyArray_NewFromDescr_` should have been using `Py_intptr_t const *` - https://github.com/numpy/numpy/blob/18a6e3e505ee416ddfc617f3e9afdff5a031c2c2/numpy/core/src/multiarray/ctors.h#L5-L8 - `PyArray_GetArrayParamsFromObject_` should be using `NPY_BOOL` - https://github.com/numpy/numpy/blob/18a6e3e505ee416ddfc617f3e9afdff5a031c2c2/numpy/core/src/multiarray/ctors.c#L1350-L1355 - https://docs.scipy.org/doc/numpy-1.13.0/reference/c-api.dtype.html#c.npy_bool - `PyArray_DescrNewFromType` is at offset 96 - https://github.com/numpy/numpy/blob/36e017194c32a53cf2965a513243cb3c348095df/numpy/core/code_generators/numpy_api.py#L141 - `array_t` constructor that takes a size and a pointer should take `ssize_t`. - Fixes pybind#1599
bstaletic
added a commit
to bstaletic/pybind11
that referenced
this issue
Jul 12, 2020
- `PyArray_NewFromDescr_` should have been using `Py_intptr_t const *` - https://github.com/numpy/numpy/blob/18a6e3e505ee416ddfc617f3e9afdff5a031c2c2/numpy/core/src/multiarray/ctors.h#L5-L8 - `PyArray_GetArrayParamsFromObject_` should be using `NPY_BOOL` - https://github.com/numpy/numpy/blob/18a6e3e505ee416ddfc617f3e9afdff5a031c2c2/numpy/core/src/multiarray/ctors.c#L1350-L1355 - https://docs.scipy.org/doc/numpy-1.13.0/reference/c-api.dtype.html#c.npy_bool - `PyArray_DescrNewFromType` is at offset 96 - https://github.com/numpy/numpy/blob/36e017194c32a53cf2965a513243cb3c348095df/numpy/core/code_generators/numpy_api.py#L141 - `array_t` constructor that takes a size and a pointer should take `ssize_t`. - Fixes pybind#1599
YannickJadoul
pushed a commit
that referenced
this issue
Jul 12, 2020
- `PyArray_NewFromDescr_` should have been using `Py_intptr_t const *` - https://github.com/numpy/numpy/blob/18a6e3e505ee416ddfc617f3e9afdff5a031c2c2/numpy/core/src/multiarray/ctors.h#L5-L8 - `PyArray_GetArrayParamsFromObject_` should be using `NPY_BOOL` - https://github.com/numpy/numpy/blob/18a6e3e505ee416ddfc617f3e9afdff5a031c2c2/numpy/core/src/multiarray/ctors.c#L1350-L1355 - https://docs.scipy.org/doc/numpy-1.13.0/reference/c-api.dtype.html#c.npy_bool - `PyArray_DescrNewFromType` is at offset 96 - https://github.com/numpy/numpy/blob/36e017194c32a53cf2965a513243cb3c348095df/numpy/core/code_generators/numpy_api.py#L141 - `array_t` constructor that takes a size and a pointer should take `ssize_t`. - Fixes #1599
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue description
The array_t constructor takes its input shape as unsigned size_t (== npt_uintp), even though the numpy API (e.g. PyArray_NewFromDescr) uses signed ssize_t (== npy_intp) and pybind11 itself uses signed sizes in most places (e.g.
ssize_t shape(ssize_t dim)
).Reproducible example code
Use the following snippet into the setup provided in the pybind11/python_example repo:
Compilation (pybind11 2.2.4, gcc 8.2.1) yields
The text was updated successfully, but these errors were encountered: