Skip to content

Commit 87084a8

Browse files
committed
Changed fs::path to be bound to os.PathLike|str.
Strings are implicitly convertible to `fs::path`, but pybind11 just uses `os.PathLike` and not `os.PathLike | str` as type annotation. Python does not support implicit conversions for annotations, so this corrects the annotations to be explicit.
1 parent 05c09e6 commit 87084a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cpp/pybind/pybind_filesystem.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ struct path_caster {
9999
return true;
100100
}
101101

102-
PYBIND11_TYPE_CASTER(T, const_name("os.PathLike"));
102+
PYBIND11_TYPE_CASTER(T, _("Union[os.PathLike, str]"));
103103
};
104104

105105
template <>

0 commit comments

Comments
 (0)