Skip to content

Commit 52b2f1b

Browse files
authored
Merge pull request #103 from influxdata/crepererum/pyo3-027
chore: `pyo3` 0.27
2 parents bd9e667 + 0e344f4 commit 52b2f1b

File tree

5 files changed

+26
-21
lines changed

5 files changed

+26
-21
lines changed

Cargo.lock

Lines changed: 9 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ datafusion-udf-wasm-bundle = { path = "guests/bundle", version = "0.1.0" }
2424
datafusion-udf-wasm-guest = { path = "guests/rust", version = "0.1.0" }
2525
datafusion-udf-wasm-python = { path = "guests/python", version = "0.1.0" }
2626
tokio = { version = "1.48.0", default-features = false }
27-
pyo3 = { version = "0.26.0", default-features = false }
27+
pyo3 = { version = "0.27.0", default-features = false }
2828
tar = { version = "0.4.44", default-features = false }
2929
tempfile = { version = "3.23.0", default-features = false }
3030
wasmtime = { version = "37.0.2", default-features = false, features = ["async", "cranelift"] }
@@ -63,9 +63,6 @@ private_intra_doc_links = "deny"
6363
datafusion-common = { git = "https://github.com/influxdata/arrow-datafusion.git", rev = "8347a71f62d4fef8d37548f22b93877170039357" }
6464
datafusion-expr = { git = "https://github.com/influxdata/arrow-datafusion.git", rev = "8347a71f62d4fef8d37548f22b93877170039357" }
6565

66-
# This is version 0.26.0 with https://github.com/PyO3/pyo3/pull/5368 backported.
67-
pyo3 = { git = "https://github.com/crepererum/pyo3.git", rev = "2a9f7e5b3d3203f3dc517c42352946bb6f352551" }
68-
6966
# faster tests
7067
[profile.dev.package]
7168
# improve wasmtime compilation speed

deny.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,5 @@ unused-allowed-source = "deny"
5757

5858
[sources.allow-org]
5959
github = [
60-
"crepererum",
6160
"influxdata",
6261
]

guests/python/src/conversion.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ impl<'py> ArrayBuilder<'py> for Float64Builder {
336336
impl<'py> ArrayBuilder<'py> for Int64Builder {
337337
fn push(&mut self, val: Bound<'py, PyAny>) -> DataFusionResult<()> {
338338
// in Python, `bool` is a sub-class of int we should probably not silently cast bools to integers
339-
let val = val.downcast_exact::<PyInt>().map_err(|_| {
339+
let val = val.cast_exact::<PyInt>().map_err(|_| {
340340
exec_datafusion_err!("expected `int` but got {}", py_representation(&val))
341341
})?;
342342
let val: i64 = val.extract().map_err(|_| {
@@ -378,7 +378,7 @@ impl<'py> ArrayBuilder<'py> for StringBuilder {
378378

379379
impl<'py> ArrayBuilder<'py> for TimestampMicrosecondBuilder {
380380
fn push(&mut self, val: Bound<'py, PyAny>) -> DataFusionResult<()> {
381-
let val = val.downcast_exact::<PyDateTime>().map_err(|_| {
381+
let val = val.cast_exact::<PyDateTime>().map_err(|_| {
382382
exec_datafusion_err!("expected `datetime` but got {}", py_representation(&val))
383383
})?;
384384
if let Some(tzinfo) = val.get_tzinfo() {

guests/python/src/inspect.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::ffi::CString;
33

44
use datafusion_common::{DataFusionError, error::Result as DataFusionResult};
55
use pyo3::{
6-
Bound, FromPyObject, PyAny, PyErr, PyResult, Python,
6+
Borrowed, Bound, FromPyObject, PyAny, PyErr, PyResult, Python,
77
exceptions::PyTypeError,
88
intern,
99
types::{PyAnyMethods, PyDictMethods, PyModuleMethods, PyStringMethods, PyTypeMethods},
@@ -14,8 +14,10 @@ use crate::{
1414
signature::{PythonFn, PythonFnSignature, PythonNullableType, PythonType},
1515
};
1616

17-
impl<'py> FromPyObject<'py> for PythonType {
18-
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> {
17+
impl<'a, 'py> FromPyObject<'a, 'py> for PythonType {
18+
type Error = PyErr;
19+
20+
fn extract(ob: Borrowed<'a, 'py, PyAny>) -> PyResult<Self> {
1921
let py = ob.py();
2022

2123
// https://docs.python.org/3/library/builtins.html
@@ -42,14 +44,16 @@ impl<'py> FromPyObject<'py> for PythonType {
4244
} else {
4345
Err(PyErr::new::<PyTypeError, _>(format!(
4446
"unknown annotation type: {}",
45-
py_representation(ob)
47+
py_representation(ob.as_any())
4648
)))
4749
}
4850
}
4951
}
5052

51-
impl<'py> FromPyObject<'py> for PythonNullableType {
52-
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> {
53+
impl<'a, 'py> FromPyObject<'a, 'py> for PythonNullableType {
54+
type Error = PyErr;
55+
56+
fn extract(ob: Borrowed<'a, 'py, PyAny>) -> PyResult<Self> {
5357
let py = ob.py();
5458

5559
// https://docs.python.org/3/library/inspect.html
@@ -105,11 +109,13 @@ impl<'py> FromPyObject<'py> for PythonNullableType {
105109
}
106110
}
107111

108-
impl<'py> FromPyObject<'py> for PythonFnSignature {
112+
impl<'a, 'py> FromPyObject<'a, 'py> for PythonFnSignature {
113+
type Error = PyErr;
114+
109115
/// Convert [`inspect.Signature`] to [`PythonFnSignature`].
110116
///
111117
/// [`inspect.Signature`]: https://docs.python.org/3/library/inspect.html#inspect.Signature
112-
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> {
118+
fn extract(ob: Borrowed<'a, 'py, PyAny>) -> PyResult<Self> {
113119
let py = ob.py();
114120

115121
// https://docs.python.org/3/library/inspect.html

0 commit comments

Comments
 (0)