|
29 | 29 | #endif
|
30 | 30 |
|
31 | 31 | /* This will be true on all flat address space platforms and allows us to reduce the
|
32 |
| - whole npy_intp / size_t / Py_intptr_t business down to just size_t for all size |
| 32 | + whole npy_intp / ssize_t / Py_intptr_t business down to just ssize_t for all size |
33 | 33 | and dimension types (e.g. shape, strides, indexing), instead of inflicting this
|
34 | 34 | upon the library user. */
|
35 |
| -static_assert(sizeof(size_t) == sizeof(Py_intptr_t), "size_t != Py_intptr_t"); |
| 35 | +static_assert(sizeof(ssize_t) == sizeof(Py_intptr_t), "ssize_t != Py_intptr_t"); |
36 | 36 |
|
37 | 37 | NAMESPACE_BEGIN(pybind11)
|
38 | 38 |
|
@@ -518,8 +518,8 @@ class array : public buffer {
|
518 | 518 |
|
519 | 519 | array() : array({{0}}, static_cast<const double *>(nullptr)) {}
|
520 | 520 |
|
521 |
| - using ShapeContainer = detail::any_container<Py_intptr_t>; |
522 |
| - using StridesContainer = detail::any_container<Py_intptr_t>; |
| 521 | + using ShapeContainer = detail::any_container<ssize_t>; |
| 522 | + using StridesContainer = detail::any_container<ssize_t>; |
523 | 523 |
|
524 | 524 | // Constructs an array taking shape/strides from arbitrary container types
|
525 | 525 | array(const pybind11::dtype &dt, ShapeContainer shape, StridesContainer strides,
|
@@ -752,7 +752,7 @@ class array : public buffer {
|
752 | 752 | throw std::domain_error("array is not writeable");
|
753 | 753 | }
|
754 | 754 |
|
755 |
| - static std::vector<Py_intptr_t> default_strides(const std::vector<Py_intptr_t>& shape, ssize_t itemsize) { |
| 755 | + static std::vector<ssize_t> default_strides(const std::vector<ssize_t>& shape, ssize_t itemsize) { |
756 | 756 | auto ndim = shape.size();
|
757 | 757 | std::vector<ssize_t> strides(ndim);
|
758 | 758 | if (ndim) {
|
|
0 commit comments