Skip to content

Commit

Permalink
[c++] Remove some compiler warnings (#3614)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl authored Jan 22, 2025
1 parent 4a17301 commit 9a7b8ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions apis/python/src/tiledbsoma/reindexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ py::array_t<int64_t> get_indexer_general_aux(
}
py::array_t<int64_t> get_indexer_general(
IntIndexer& indexer, py::array_t<int64_t> lookups) {
if (lookups.ndim() != 1)
if (lookups.ndim() != 1) {
throw std::invalid_argument(
"IntIndexer only supports arrays of dimension 1");
if (lookups.dtype() != py::dtype::of<int64_t>())
}
if (!lookups.dtype().is(py::dtype::of<int64_t>())) {
throw py::type_error("IntIndexer only supports array of type int64");
}

try {
return get_indexer_general_aux(indexer, lookups);
Expand Down Expand Up @@ -182,12 +184,14 @@ void load_reindexer(py::module& m) {
.def(
"map_locations",
[](IntIndexer& indexer, py::array keys) {
if (keys.ndim() != 1)
if (keys.ndim() != 1) {
throw std::invalid_argument(
"IntIndexer only supports arrays of dimension 1");
if (keys.dtype() != py::dtype::of<int64_t>())
}
if (!keys.dtype().is(py::dtype::of<int64_t>())) {
throw py::type_error(
"IntIndexer only supports array of type int64");
}

auto keys_int64 = py::cast<py::array_t<int64_t>>(keys);
try {
Expand Down
3 changes: 3 additions & 0 deletions apis/python/src/tiledbsoma/soma_object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ void load_soma_object(py::module& m) {
"already handled. This indicates a logic error or an "
"unexpected failure to catch exceptions by "
"SOMAObject::open");

return py::none(); // Unreached, but appeases a compiler
// warning
},
"uri"_a,
"mode"_a,
Expand Down

0 comments on commit 9a7b8ce

Please sign in to comment.