Skip to content

Commit be08bd7

Browse files
committed
Oh C++, what fun you are.
1 parent 9a1201f commit be08bd7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/binding.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ PYBIND11_MODULE(can_ada, m) {
1111
m.attr("__version__") = "dev";
1212
#endif
1313

14-
m.def("can_parse", [](std::string_view input, std::optional<std::string_view*> base_input) {
15-
return ada::can_parse(input, base_input.value_or(nullptr));
14+
m.def("can_parse", [](std::string_view input, std::optional<const std::string_view> base_input) {
15+
if (base_input.has_value()) {
16+
return ada::can_parse(input, &base_input.value());
17+
}
18+
return ada::can_parse(input);
1619
}, py::arg("input"), py::arg("base_input") = py::none());
1720

1821
py::class_<ada::url_aggregator>(m, "URL")

0 commit comments

Comments
 (0)