Add a std::filesystem::path <-> os.PathLike caster. (#2730)

This commit is contained in:
Antony Lee
2021-07-02 16:00:50 +02:00
committed by GitHub
parent f067deb563
commit 5bcaaa0423
5 changed files with 149 additions and 0 deletions

View File

@@ -238,6 +238,12 @@ TEST_SUBMODULE(stl, m) {
.def("member_initialized", &opt_exp_holder::member_initialized);
#endif
#ifdef PYBIND11_HAS_FILESYSTEM
// test_fs_path
m.attr("has_filesystem") = true;
m.def("parent_path", [](const std::filesystem::path& p) { return p.parent_path(); });
#endif
#ifdef PYBIND11_HAS_VARIANT
static_assert(std::is_same<py::detail::variant_caster_visitor::result_type, py::handle>::value,
"visitor::result_type is required by boost::variant in C++11 mode");