mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-06-05 04:58:53 +02:00
pybind: make Cluster and ClusterVector bindings module-local
- After upgrading to pybind11 3, duplicate registration of cluster-related types across `_aare` and `_aare_cuda` started failing. - Mark the `Cluster` and `ClusterVector` bindings as `py::module_local()` so each extension owns its local registration. Note: cluster objects from CPU and CUDA bindings are now distinct Python types.
This commit is contained in:
@@ -23,7 +23,7 @@ void define_Cluster(py::module &m, const std::string &typestr) {
|
||||
auto class_name = fmt::format("Cluster{}", typestr);
|
||||
|
||||
py::class_<Cluster<Type, ClusterSizeX, ClusterSizeY, CoordType>>(
|
||||
m, class_name.c_str(), py::buffer_protocol())
|
||||
m, class_name.c_str(), py::buffer_protocol(), py::module_local())
|
||||
|
||||
.def(py::init([](CoordType x, CoordType y,
|
||||
py::array_t<Type, py::array::forcecast> data) {
|
||||
|
||||
@@ -31,7 +31,8 @@ void define_ClusterVector(py::module &m, const std::string &typestr) {
|
||||
py::class_<ClusterVector<
|
||||
Cluster<Type, ClusterSizeX, ClusterSizeY, CoordType>, void>>(
|
||||
m, class_name.c_str(),
|
||||
py::buffer_protocol())
|
||||
py::buffer_protocol(),
|
||||
py::module_local())
|
||||
|
||||
.def(py::init()) // TODO change!!!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user