Skip to content

Commit 09af177

Browse files
committed
Fixes to compile on MacOS with clang.
1 parent 3b75233 commit 09af177

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

.github/workflows/run-tests.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ name: Run tests
88

99
jobs:
1010
build:
11-
name: Run tests
12-
runs-on: ubuntu-latest
11+
name: ${{ matrix.os }}, ${{ matrix.parallel }}
12+
runs-on: ${{ matrix.os }}
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
parallel: [true, false]
16+
parallel: [ 'serial', 'parallel' ]
17+
os: [ 'ubuntu-latest', 'macos-latest' ]
1718

1819
steps:
1920
- uses: actions/checkout@v4
@@ -31,7 +32,7 @@ jobs:
3132
cache: 'pip'
3233

3334
- name: Turn off parallelization flags
34-
if: ${{ !matrix.parallel }}
35+
if: ${{ matrix.parallel== 'serial' }}
3536
run: |
3637
cat tests/lib/CMakeLists.txt | grep -v "TEST_CUSTOM_PARALLEL" > .tmp
3738
cat .tmp

include/tatami_python/UnknownMatrix.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ class UnknownMatrix : public tatami::Matrix<Value_, Index_> {
8383
tatami::can_cast_Index_to_container_size<pybind11::array_t<Index_> >(std::max(my_nrow, my_ncol));
8484

8585
auto sparse = my_module.attr("is_sparse")(my_seed);
86-
my_sparse = sparse.cast<bool>();
86+
my_sparse = sparse.template cast<bool>();
8787

8888
auto grid = my_module.attr("chunk_grid")(my_seed);
89-
auto bounds = grid.attr("boundaries").cast<pybind11::tuple>();
89+
auto bounds = grid.attr("boundaries").template cast<pybind11::tuple>();
9090
if (bounds.size() != 2) {
9191
auto ctype = get_class_name(seed);
9292
throw std::runtime_error("'chunk_grid(<" + ctype + ">).boundaries' should be a tuple of length 2");

include/tatami_python/sparse_matrix.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void parse_Sparse2darray(const pybind11::object& matrix, Value_* const vbuffer,
9090
if (pybind11::isinstance<pybind11::none>(raw_svt)) {
9191
return;
9292
}
93-
auto svt = raw_svt.cast<pybind11::list>();
93+
auto svt = raw_svt.template cast<pybind11::list>();
9494

9595
const auto shape = get_shape<Index_>(matrix);
9696
const auto NR = shape.first;
@@ -102,18 +102,18 @@ void parse_Sparse2darray(const pybind11::object& matrix, Value_* const vbuffer,
102102
continue;
103103
}
104104

105-
auto inner = raw_inner.cast<pybind11::tuple>();
105+
auto inner = raw_inner.template cast<pybind11::tuple>();
106106
if (inner.size() != 2) {
107107
auto ctype = get_class_name(matrix);
108108
throw std::runtime_error("each entry of '<" + ctype + ">.contents' should be a tuple of length 2 or None");
109109
}
110110

111-
auto iinput = inner[0].cast<pybind11::array>();
111+
auto iinput = inner[0].template cast<pybind11::array>();
112112
if (ibuffer != NULL) {
113113
dump_to_buffer(iinput, ibuffer);
114114
}
115115
if (vbuffer != NULL) {
116-
auto vinput = inner[1].cast<pybind11::array>();
116+
auto vinput = inner[1].template cast<pybind11::array>();
117117
dump_to_buffer(vinput, vbuffer);
118118
}
119119

include/tatami_python/utils.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,22 @@ inline std::string get_class_name(const pybind11::object& incoming) {
2626
if (!pybind11::hasattr(cls, "__name__")) {
2727
return "unnamed";
2828
}
29-
return cls.attr("__name__").cast<std::string>();
29+
return cls.attr("__name__").template cast<std::string>();
3030
}
3131

3232
template<typename Index_>
3333
std::pair<Index_, Index_> get_shape(const pybind11::object& obj) {
3434
auto shape = obj.attr("shape");
35-
auto tup = shape.cast<pybind11::tuple>();
35+
auto tup = shape.template cast<pybind11::tuple>();
3636
if (tup.size() != 2) {
3737
auto ctype = get_class_name(obj);
3838
throw std::runtime_error("'<" + ctype + ">.shape' should return an integer vector");
3939
}
4040

4141
// We use pybind11's own size type that it uses for NumPy shapes.
4242
// TODO: check if pybind11::cast() throws an error if it is outside of the range of the target type.
43-
auto raw_nrow = tup[0].cast<pybind11::ssize_t>();
44-
auto raw_ncol = tup[1].cast<pybind11::ssize_t>();
43+
auto raw_nrow = tup[0].template cast<pybind11::ssize_t>();
44+
auto raw_ncol = tup[1].template cast<pybind11::ssize_t>();
4545
if (raw_nrow < 0 || raw_ncol < 0) {
4646
auto ctype = get_class_name(obj);
4747
throw std::runtime_error("'dim(<" + ctype + ">)' should contain two non-negative integers");

0 commit comments

Comments
 (0)