Skip to content

Commit db94df3

Browse files
committed
Return py::object instead of std::variant to pybind11
Pybind's variant handling explodes MSVC, so we do it instead.
1 parent a63d52a commit db94df3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/binding/python/Attributable.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,9 @@ void init_Attributable(py::module &m)
618618
"get_attribute",
619619
[](Attributable &attr, std::string const &key) {
620620
auto v = attr.getAttribute(key);
621-
return v.getVariant<attribute_types>();
621+
return std::visit(
622+
[](auto const &val) { return py::cast(val); },
623+
v.getVariant<attribute_types>());
622624
// TODO instead of returning lists, return all arrays (ndim > 0)
623625
// as numpy arrays?
624626
})

0 commit comments

Comments
 (0)