Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ambiguous capsule calls with pybind11 #1887

Merged
merged 3 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions tiledb/cc/attribute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ void init_attribute(py::module &m) {

.def(py::init<const Context &, py::capsule>())

.def("__capsule__",
[](Attribute &attr) {
return py::capsule(attr.ptr().get(), "attr", nullptr);
})
.def(
"__capsule__",
[](Attribute &attr) { return py::capsule(attr.ptr().get(), "attr"); })

.def_property_readonly("_name", &Attribute::name)

Expand Down
10 changes: 3 additions & 7 deletions tiledb/cc/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,10 @@ void init_context(py::module &m) {
.def(py::init<py::capsule, bool>())

.def("__capsule__",
[](Context &ctx) {
return py::capsule(ctx.ptr().get(), "ctx", nullptr);
})
[](Context &ctx) { return py::capsule(ctx.ptr().get(), "ctx"); })

.def("__capsule__",
[](Context &ctx) {
return py::capsule(ctx.ptr().get(), "ctx", nullptr);
})
[](Context &ctx) { return py::capsule(ctx.ptr().get(), "ctx"); })

.def("config", &Context::config)
.def("set_tag", &Context::set_tag)
Expand All @@ -42,7 +38,7 @@ void init_config(py::module &m) {

.def("__capsule__",
[](Config &config) {
return py::capsule(config.ptr().get(), "config", nullptr);
return py::capsule(config.ptr().get(), "config");
})

.def("set", &Config::set)
Expand Down
2 changes: 1 addition & 1 deletion tiledb/cc/dimension_label.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void init_dimension_label(py::module &m) {

.def("__capsule__",
[](DimensionLabel &dim_label) {
return py::capsule(dim_label.ptr().get(), "dim_label", nullptr);
return py::capsule(dim_label.ptr().get(), "dim_label");
})

.def_property_readonly("_label_attr_name",
Expand Down
6 changes: 2 additions & 4 deletions tiledb/cc/domain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,7 @@ void init_domain(py::module &m) {
.def(py::init<const Context &, py::capsule>())

.def("__capsule__",
[](Domain &dom) {
return py::capsule(dom.ptr().get(), "dom", nullptr);
})
[](Domain &dom) { return py::capsule(dom.ptr().get(), "dom"); })

.def_property_readonly("_ncell",
[](Domain &dom) { return dom.cell_num(); })
Expand All @@ -206,4 +204,4 @@ void init_domain(py::module &m) {
.def("_dump", [](Domain &dom) { dom.dump(); });
}

} // namespace libtiledbcpp
} // namespace libtiledbcpp
4 changes: 2 additions & 2 deletions tiledb/cc/enumeration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void init_enumeration(py::module &m) {

.def("__capsule__",
[](Enumeration &enmr) {
return py::capsule(enmr.ptr().get(), "enmr", nullptr);
return py::capsule(enmr.ptr().get(), "enmr");
})

.def_property_readonly("name", &Enumeration::name)
Expand Down Expand Up @@ -95,4 +95,4 @@ void init_enumeration(py::module &m) {
});
}

} // namespace libtiledbcpp
} // namespace libtiledbcpp
2 changes: 1 addition & 1 deletion tiledb/cc/filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void init_filter(py::module &m) {

.def("__capsule__",
[](FilterList &filterlist) {
return py::capsule(filterlist.ptr().get(), "fl", nullptr);
return py::capsule(filterlist.ptr().get(), "fl");
})

.def_property("_chunksize", &FilterList::max_chunk_size,
Expand Down
2 changes: 1 addition & 1 deletion tiledb/cc/schema.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void init_schema(py::module &m) {

.def("__capsule__",
[](ArraySchema &schema) {
return py::capsule(schema.ptr().get(), "schema", nullptr);
return py::capsule(schema.ptr().get(), "schema");
})

.def("_dump", &ArraySchema::dump)
Expand Down
2 changes: 1 addition & 1 deletion tiledb/cc/subarray.cc
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ void init_subarray(py::module &m) {

.def("__capsule__",
[](Subarray &subarray) {
return py::capsule(subarray.ptr().get(), "subarray", nullptr);
return py::capsule(subarray.ptr().get(), "subarray");
})

.def("_add_dim_range",
Expand Down
2 changes: 1 addition & 1 deletion tiledb/query_condition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class PyQueryCondition {

shared_ptr<QueryCondition> ptr() { return qc_; }

py::capsule __capsule__() { return py::capsule(&qc_, "qc", nullptr); }
py::capsule __capsule__() { return py::capsule(&qc_, "qc"); }

void set_use_enumeration(bool use_enumeration) {
QueryConditionExperimental::set_use_enumeration(ctx_, *qc_,
Expand Down
Loading