Open
Description
For example, take this very simple rust function. Calling it from python will result in PathBuf
getting converted to builtins.str
instead of pathlib.Path
. My feature request is that it should instead convert to pathlib.Path
.
fn get_parent_directory(path: PathBuf) -> PyResult<PathBuf> {
let dir = match path.as_ref().parent() {
Some(parent) if parent == Path::new("") => Path::new("."),
Some(parent) => parent,
None => Path::new("."),
};
let dir = dunce::canonicalize(dir).map_err(|e| PyOSError::new_err(e.to_string()))?;
Ok(dir)
}