diff --git a/src/types/osstr.rs b/src/types/osstr.rs index be4fdc10e4c..0bebb0a06c3 100644 --- a/src/types/osstr.rs +++ b/src/types/osstr.rs @@ -1,10 +1,13 @@ use crate::types::PyString; +#[cfg(not(windows))] +use crate::PyNativeType; use crate::{ - ffi, AsPyPointer, FromPyObject, IntoPy, PyAny, PyNativeType, PyObject, PyResult, PyTryFrom, - Python, ToPyObject, + ffi, AsPyPointer, FromPyObject, IntoPy, PyAny, PyObject, PyResult, PyTryFrom, Python, + ToPyObject, }; use std::borrow::Cow; use std::ffi::{OsStr, OsString}; +#[cfg(not(windows))] use std::os::raw::c_char; impl ToPyObject for OsStr { @@ -178,7 +181,7 @@ mod test { // do a roundtrip into Pythonland and back and compare let py_str = os_str.into_py(py); - let os_str_2: &OsStr = py_str.extract(py).unwrap(); + let os_str_2: OsString = py_str.extract(py).unwrap(); assert_eq!(os_str, os_str_2); }) } diff --git a/src/types/path.rs b/src/types/path.rs index 199af8efb04..c8b5478c773 100644 --- a/src/types/path.rs +++ b/src/types/path.rs @@ -1,6 +1,8 @@ use crate::{FromPyObject, IntoPy, PyAny, PyObject, PyResult, Python, ToPyObject}; use std::borrow::Cow; -use std::ffi::{OsStr, OsString}; +#[cfg(not(windows))] +use std::ffi::OsStr; +use std::ffi::OsString; use std::path::{Path, PathBuf}; impl ToPyObject for Path {