Skip to content

Commit

Permalink
fix deprecation warnings in polars-plan
Browse files Browse the repository at this point in the history
  • Loading branch information
bschoenmaeckers committed Dec 2, 2024
1 parent f3af8c0 commit 9bc2104
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/polars-plan/src/dsl/python_udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ impl PythonUdfExpression {

// Load UDF
Python::with_gil(|py| {
let pickle = PyModule::import_bound(py, "pickle")
let pickle = PyModule::import(py, "pickle")
.expect("unable to import 'pickle'")
.getattr("loads")
.unwrap();
let arg = (PyBytes::new_bound(py, remainder),);
let arg = (PyBytes::new(py, remainder),);
let python_function = pickle.call1(arg).map_err(from_pyerr)?;
Ok(Arc::new(Self::new(
python_function.into(),
Expand Down Expand Up @@ -136,15 +136,15 @@ impl ColumnsUdf for PythonUdfExpression {

Python::with_gil(|py| {
// Try pickle to serialize the UDF, otherwise fall back to cloudpickle.
let pickle = PyModule::import_bound(py, "pickle")
let pickle = PyModule::import(py, "pickle")
.expect("unable to import 'pickle'")
.getattr("dumps")
.unwrap();
let pickle_result = pickle.call1((self.python_function.clone_ref(py),));
let (dumped, use_cloudpickle) = match pickle_result {
Ok(dumped) => (dumped, false),
Err(_) => {
let cloudpickle = PyModule::import_bound(py, "cloudpickle")
let cloudpickle = PyModule::import(py, "cloudpickle")
.map_err(from_pyerr)?
.getattr("dumps")
.unwrap();
Expand Down

0 comments on commit 9bc2104

Please sign in to comment.