Skip to content

Commit

Permalink
Changed fs::path to be bound to os.PathLike|str.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
timohl committed Nov 26, 2024
1 parent 05c09e6 commit 87084a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cpp/pybind/pybind_filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ struct path_caster {
return true;
}

PYBIND11_TYPE_CASTER(T, const_name("os.PathLike"));
PYBIND11_TYPE_CASTER(T, _("Union[os.PathLike, str]"));
};

template <>
Expand Down

0 comments on commit 87084a8

Please sign in to comment.