-
Notifications
You must be signed in to change notification settings - Fork 244
Open
Description
Describe the bug
The serialized_length property on the Python Index class raises a TypeError when accessed. The pybind11 binding doesn't expose the default argument for the serialization_config_t parameter, so Python callers cannot use the property without explicitly providing a config object (which isn't possible via the property interface).
The binding in python/lib.cpp:
i.def_property_readonly("serialized_length", &dense_index_py_t::serialized_length);The C++ method signature in index_dense.hpp:
std::size_t serialized_length(serialization_config_t config = {}) constSuggested fix - wrap in a lambda:
i.def_property_readonly("serialized_length", [](dense_index_py_t const& self) {
return self.serialized_length();
});Steps to reproduce
from usearch.index import Index, MetricKind, ScalarKind
import numpy as np
idx = Index(ndim=32, metric=MetricKind.Hamming, dtype=ScalarKind.B1)
idx.add(1, np.array([178, 204, 60, 240], dtype=np.uint8))
# This raises TypeError
result = idx.serialized_lengthError:
TypeError: (): incompatible function arguments. The following argument types are supported:
1. (arg0: usearch.compiled.Index, arg1: unum::usearch::index_dense_serialization_config_t) -> int
Invoked with: <usearch.compiled.Index object at 0x...>
Expected behavior
idx.serialized_length should return an integer representing the serialized length in bytes, using the C++ default config value.
USearch version
v2.21.0
Operating System
Windows 11 (also reproduced on Linux)
Hardware architecture
x86
Which interface are you using?
Python bindings
Searched existing issues
I have searched existing issues and this hasn't been reported.
Code of Conduct
I agree to the Code of Conduct.
Metadata
Metadata
Assignees
Labels
No labels