Skip to content

Commit

Permalink
build: Revert PyO3 version back to 0.21 (#19376)
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego authored Oct 23, 2024
1 parent 8bf14d8 commit e1dfcdd
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 51 deletions.
31 changes: 15 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,12 @@ memmap = { package = "memmap2", version = "0.7" }
multiversion = "0.7"
ndarray = { version = "0.15", default-features = false }
num-traits = "0.2"
numpy = "0.22"
object_store = { version = "0.10", default-features = false }
once_cell = "1"
parking_lot = "0.12"
percent-encoding = "2.3"
pin-project-lite = "0.2"
pyo3 = "0.22"
pyo3 = "0.21"
rand = "0.8"
rand_distr = "0.4"
raw-cpuid = "11"
Expand Down
4 changes: 3 additions & 1 deletion crates/polars-python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ itoa = { workspace = true }
libc = { workspace = true }
ndarray = { workspace = true }
num-traits = { workspace = true }
numpy = { workspace = true }
# TODO: Pin to released version once NumPy 2.0 support is merged
# https://github.com/PyO3/rust-numpy/issues/409
numpy = { git = "https://github.com/stinodego/rust-numpy.git", rev = "9ba9962ae57ba26e35babdce6f179edf5fe5b9c8", default-features = false }
once_cell = { workspace = true }
pyo3 = { workspace = true, features = ["abi3-py39", "chrono", "multiple-pymethods"] }
recursive = { workspace = true }
Expand Down
10 changes: 1 addition & 9 deletions crates/polars-python/src/conversion/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,20 +604,12 @@ impl IntoPy<PyObject> for Wrap<&Schema> {
}
}

#[derive(Debug)]
#[derive(Clone, Debug)]
#[repr(transparent)]
pub struct ObjectValue {
pub inner: PyObject,
}

impl Clone for ObjectValue {
fn clone(&self) -> Self {
Python::with_gil(|py| Self {
inner: self.inner.clone_ref(py),
})
}
}

impl Hash for ObjectValue {
fn hash<H: Hasher>(&self, state: &mut H) {
let h = Python::with_gil(|py| self.inner.bind(py).hash().expect("should be hashable"));
Expand Down
9 changes: 1 addition & 8 deletions crates/polars-python/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,11 @@ use pyo3::types::{PyBytes, PyString, PyStringMethods};
use crate::error::PyPolarsErr;
use crate::prelude::resolve_homedir;

#[derive(Clone)]
pub struct PyFileLikeObject {
inner: PyObject,
}

impl Clone for PyFileLikeObject {
fn clone(&self) -> Self {
Python::with_gil(|py| Self {
inner: self.inner.clone_ref(py),
})
}
}

/// Wraps a `PyObject`, and implements read, seek, and write for it.
impl PyFileLikeObject {
/// Creates an instance of a `PyFileLikeObject` from a `PyObject`.
Expand Down
16 changes: 8 additions & 8 deletions crates/polars-python/src/lazyframe/visitor/expr_nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ impl IntoPy<PyObject> for Wrap<ClosedInterval> {
}
}

#[pyclass(name = "Operator", eq)]
#[derive(Copy, Clone, PartialEq)]
#[pyclass(name = "Operator")]
#[derive(Copy, Clone)]
pub enum PyOperator {
Eq,
EqValidity,
Expand Down Expand Up @@ -129,8 +129,8 @@ impl IntoPy<PyObject> for Wrap<InequalityOperator> {
}
}

#[pyclass(name = "StringFunction", eq)]
#[derive(Copy, Clone, PartialEq)]
#[pyclass(name = "StringFunction")]
#[derive(Copy, Clone)]
pub enum PyStringFunction {
ConcatHorizontal,
ConcatVertical,
Expand Down Expand Up @@ -184,8 +184,8 @@ impl PyStringFunction {
}
}

#[pyclass(name = "BooleanFunction", eq)]
#[derive(Copy, Clone, PartialEq)]
#[pyclass(name = "BooleanFunction")]
#[derive(Copy, Clone)]
pub enum PyBooleanFunction {
Any,
All,
Expand Down Expand Up @@ -213,8 +213,8 @@ impl PyBooleanFunction {
}
}

#[pyclass(name = "TemporalFunction", eq)]
#[derive(Copy, Clone, PartialEq)]
#[pyclass(name = "TemporalFunction")]
#[derive(Copy, Clone)]
pub enum PyTemporalFunction {
Millennium,
Century,
Expand Down
8 changes: 1 addition & 7 deletions crates/polars-utils/src/python_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,9 @@ pub use serde_wrap::{

use crate::flatten;

#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct PythonFunction(pub PyObject);

impl Clone for PythonFunction {
fn clone(&self) -> Self {
Python::with_gil(|py| Self(self.0.clone_ref(py)))
}
}

impl From<PyObject> for PythonFunction {
fn from(value: PyObject) -> Self {
Self(value)
Expand Down

0 comments on commit e1dfcdd

Please sign in to comment.