Skip to content

Commit 110256a

Browse files
committed
fix: wheel building exposed ssize_t issue
1 parent 6374ba3 commit 110256a

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

.github/workflows/wheels.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ on:
1919

2020
env:
2121
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.overrideVersion }}
22-
CIBW_ENVIRONMENT: "PIP_ONLY_BINARY=numpy SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.overrideVersion }}"
22+
CIBW_ENVIRONMENT: "PIP_PREFER_BINARY=1 SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.overrideVersion }}"
2323

2424
jobs:
2525
build_sdist:
@@ -81,12 +81,16 @@ jobs:
8181
matrix:
8282
os: [windows-latest, macos-latest, ubuntu-latest]
8383
arch: [auto64]
84-
build: ["*"]
84+
build: ["?p3?-* *macos* *win*"]
85+
CIBW_MANYLINUX_X86_64_IMAGE: [manylinux2010]
86+
CIBW_MANYLINUX_I686_IMAGE: [manylinux2010]
8587

8688
include:
8789
- os: ubuntu-latest
8890
arch: auto32
89-
build: "*"
91+
build: "?p3?-*"
92+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
93+
CIBW_MANYLINUX_I686_IMAGE: manylinux2010
9094

9195
- os: ubuntu-latest
9296
type: ManyLinux1
@@ -95,6 +99,13 @@ jobs:
9599
CIBW_MANYLINUX_X86_64_IMAGE: skhep/manylinuxgcc-x86_64
96100
CIBW_MANYLINUX_I686_IMAGE: skhep/manylinuxgcc-i686
97101

102+
- os: ubuntu-latest
103+
type: ManyLinux2014
104+
arch: auto
105+
build: "cp310-*"
106+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
107+
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
108+
98109
- os: macos-latest
99110
arch: universal2
100111
build: "*"

include/bh_python/histogram.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ namespace detail {
3131
template <class Axes, class T>
3232
py::buffer_info make_buffer_impl(const Axes& axes, bool flow, T* ptr) {
3333
// strides are in bytes
34-
auto shape = bh::detail::make_stack_buffer<ssize_t>(axes);
35-
auto strides = bh::detail::make_stack_buffer<ssize_t>(axes);
36-
ssize_t stride = sizeof(T);
37-
unsigned rank = 0;
38-
char* start = reinterpret_cast<char*>(ptr);
34+
auto shape = bh::detail::make_stack_buffer<py::ssize_t>(axes);
35+
auto strides = bh::detail::make_stack_buffer<py::ssize_t>(axes);
36+
py::ssize_t stride = sizeof(T);
37+
unsigned rank = 0;
38+
char* start = reinterpret_cast<char*>(ptr);
3939
bh::detail::for_each_axis(axes, [&](const auto& axis) {
4040
const bool underflow
4141
= bh::axis::traits::options(axis) & bh::axis::option::underflow;

include/bh_python/pybind11.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ std::string shift_to_string(const T& x) {
4545
}
4646

4747
template <class Obj>
48-
void unchecked_set_impl(std::true_type, py::tuple& tup, ssize_t i, Obj&& obj) {
48+
void unchecked_set_impl(std::true_type, py::tuple& tup, py::ssize_t i, Obj&& obj) {
4949
// PyTuple_SetItem steals a reference to 'val'
5050
if(PyTuple_SetItem(tup.ptr(), i, obj.release().ptr()) != 0) {
5151
throw py::error_already_set();
5252
}
5353
}
5454

5555
template <class T>
56-
void unchecked_set_impl(std::false_type, py::tuple& tup, ssize_t i, T&& t) {
56+
void unchecked_set_impl(std::false_type, py::tuple& tup, py::ssize_t i, T&& t) {
5757
unchecked_set_impl(std::true_type{}, tup, i, py::cast(std::forward<T>(t)));
5858
}
5959

@@ -62,6 +62,6 @@ template <class T>
6262
void unchecked_set(py::tuple& tup, std::size_t i, T&& t) {
6363
unchecked_set_impl(std::is_base_of<py::object, std::decay_t<T>>{},
6464
tup,
65-
static_cast<ssize_t>(i),
65+
static_cast<py::ssize_t>(i),
6666
std::forward<T>(t));
6767
}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,5 @@ ignore = [
8484
[tool.cibuildwheel]
8585
test-extras = "test"
8686
test-command = "pytest {project}/tests"
87-
test-skip = ["pp*macos*", "pp*win*", "*universal2:arm64"]
87+
test-skip = ["pp*macos*", "pp*win*", "*universal2:arm64", "cp310*macos*"]
8888
skip = ["pp*-manylinux_i686"] # not supported by NumPy

0 commit comments

Comments
 (0)