Skip to content

Commit dcca712

Browse files
committed
fix(python): resolve Clang narrowing error for 1D py::array_t initialization on macOS
1 parent 2576864 commit dcca712

2 files changed

Lines changed: 2 additions & 7 deletions

File tree

‎examples/vibe/module.py‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,6 @@ def fit(self, X: np.ndarray):
233233
rerank_factor=self.rerank_size_factor,
234234
)
235235

236-
# Clean up temporary data / graphs and wait briefly for threads/CPU to settle
237-
del graph, X_f32, quantized_features
238-
gc.collect()
239-
time.sleep(5)
240-
241236
def set_query_arguments(self, search_eps: float, rerank_size_factor: float = 1.0):
242237
"""Sets query-time search_eps and rerank scaling factor."""
243238
self.search_eps = float(search_eps)

‎python/src/deg_cpp/deglib_cpp.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,13 +830,13 @@ class SearcherPy {
830830
if (buf.ndim != 1 && (buf.ndim != 2 || buf.shape[0] != 1)) {
831831
throw std::invalid_argument("search query must be 1D vector (or 1xDim 2D array)");
832832
}
833-
auto result = py::array_t<uint32_t>({size_t(k)});
833+
py::array_t<uint32_t> result(static_cast<py::ssize_t>(k));
834834
uint32_t* out_ptr = static_cast<uint32_t*>(result.request().ptr);
835835

836836
py::array_t<float> dist_result;
837837
float* dist_ptr = nullptr;
838838
if (return_distances) {
839-
dist_result = py::array_t<float>({size_t(k)});
839+
dist_result = py::array_t<float>(static_cast<py::ssize_t>(k));
840840
dist_ptr = static_cast<float*>(dist_result.request().ptr);
841841
}
842842

0 commit comments

Comments
 (0)