Skip to content

Commit

Permalink
feat(rust): auto select compat_level in PySeries::extract_bound
Browse files Browse the repository at this point in the history
  • Loading branch information
ruihe774 committed Jul 7, 2024
1 parent 3265692 commit 8d4c463
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pyo3-polars/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ impl<'a> FromPyObject<'a> for PySeries {
let name = py_name.to_cow()?;

let kwargs = PyDict::new_bound(ob.py());
kwargs.set_item("future", true)?;
if let Ok(compat_level) = ob.call_method0("_newest_compat_level") {
let compat_level = compat_level.extract().unwrap();
let compat_level =
CompatLevel::with_level(compat_level).unwrap_or(CompatLevel::newest());
kwargs.set_item("compat_level", compat_level.get_level())?;
}
let arr = ob.call_method("to_arrow", (), Some(&kwargs))?;
let arr = ffi::to_rust::array_to_rust(&arr)?;
Ok(PySeries(
Expand Down

0 comments on commit 8d4c463

Please sign in to comment.