Skip to content

Commit ca0ccd7

Browse files
authored
Fix ambiguous capsule calls with pybind11 (#1887)
* Fix ambiguous capsule calls with pybind11 - nullptr arg errors I got multiple errors like this: error: call of overloaded ‘capsule(std::__shared_ptr<tiledb_subarray_t, __gnu_cxx::_S_atomic>::element_type*, const char [9], std::nullptr_t)’ is ambiguous when building fresh with latest pybind on ubuntu22, m6id.4xlarge ec2 machine.
1 parent 2cd7806 commit ca0ccd7

File tree

9 files changed

+15
-22
lines changed

9 files changed

+15
-22
lines changed

tiledb/cc/attribute.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,9 @@ void init_attribute(py::module &m) {
6767

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

70-
.def("__capsule__",
71-
[](Attribute &attr) {
72-
return py::capsule(attr.ptr().get(), "attr", nullptr);
73-
})
70+
.def(
71+
"__capsule__",
72+
[](Attribute &attr) { return py::capsule(attr.ptr().get(), "attr"); })
7473

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

tiledb/cc/context.cc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,10 @@ void init_context(py::module &m) {
1818
.def(py::init<py::capsule, bool>())
1919

2020
.def("__capsule__",
21-
[](Context &ctx) {
22-
return py::capsule(ctx.ptr().get(), "ctx", nullptr);
23-
})
21+
[](Context &ctx) { return py::capsule(ctx.ptr().get(), "ctx"); })
2422

2523
.def("__capsule__",
26-
[](Context &ctx) {
27-
return py::capsule(ctx.ptr().get(), "ctx", nullptr);
28-
})
24+
[](Context &ctx) { return py::capsule(ctx.ptr().get(), "ctx"); })
2925

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

4339
.def("__capsule__",
4440
[](Config &config) {
45-
return py::capsule(config.ptr().get(), "config", nullptr);
41+
return py::capsule(config.ptr().get(), "config");
4642
})
4743

4844
.def("set", &Config::set)

tiledb/cc/dimension_label.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void init_dimension_label(py::module &m) {
8080

8181
.def("__capsule__",
8282
[](DimensionLabel &dim_label) {
83-
return py::capsule(dim_label.ptr().get(), "dim_label", nullptr);
83+
return py::capsule(dim_label.ptr().get(), "dim_label");
8484
})
8585

8686
.def_property_readonly("_label_attr_name",

tiledb/cc/domain.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,7 @@ void init_domain(py::module &m) {
182182
.def(py::init<const Context &, py::capsule>())
183183

184184
.def("__capsule__",
185-
[](Domain &dom) {
186-
return py::capsule(dom.ptr().get(), "dom", nullptr);
187-
})
185+
[](Domain &dom) { return py::capsule(dom.ptr().get(), "dom"); })
188186

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

209-
} // namespace libtiledbcpp
207+
} // namespace libtiledbcpp

tiledb/cc/enumeration.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void init_enumeration(py::module &m) {
6565

6666
.def("__capsule__",
6767
[](Enumeration &enmr) {
68-
return py::capsule(enmr.ptr().get(), "enmr", nullptr);
68+
return py::capsule(enmr.ptr().get(), "enmr");
6969
})
7070

7171
.def_property_readonly("name", &Enumeration::name)
@@ -95,4 +95,4 @@ void init_enumeration(py::module &m) {
9595
});
9696
}
9797

98-
} // namespace libtiledbcpp
98+
} // namespace libtiledbcpp

tiledb/cc/filter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void init_filter(py::module &m) {
122122

123123
.def("__capsule__",
124124
[](FilterList &filterlist) {
125-
return py::capsule(filterlist.ptr().get(), "fl", nullptr);
125+
return py::capsule(filterlist.ptr().get(), "fl");
126126
})
127127

128128
.def_property("_chunksize", &FilterList::max_chunk_size,

tiledb/cc/schema.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ void init_schema(py::module &m) {
173173

174174
.def("__capsule__",
175175
[](ArraySchema &schema) {
176-
return py::capsule(schema.ptr().get(), "schema", nullptr);
176+
return py::capsule(schema.ptr().get(), "schema");
177177
})
178178

179179
.def("_dump", &ArraySchema::dump)

tiledb/cc/subarray.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ void init_subarray(py::module &m) {
554554

555555
.def("__capsule__",
556556
[](Subarray &subarray) {
557-
return py::capsule(subarray.ptr().get(), "subarray", nullptr);
557+
return py::capsule(subarray.ptr().get(), "subarray");
558558
})
559559

560560
.def("_add_dim_range",

tiledb/query_condition.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class PyQueryCondition {
5858

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

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

6363
void set_use_enumeration(bool use_enumeration) {
6464
QueryConditionExperimental::set_use_enumeration(ctx_, *qc_,

0 commit comments

Comments
 (0)