Skip to content

Commit 9b0d107

Browse files
[ffe] Upgrade PyO3 to O.27.2
1 parent 5027515 commit 9b0d107

File tree

5 files changed

+26
-20
lines changed

5 files changed

+26
-20
lines changed

Cargo.lock

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

datadog-ffe/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ serde-bool = { version = "0.1.3", default-features = false }
2323
serde_with = { version = "3.11.0", default-features = false, features = ["base64", "hex", "macros"] }
2424
thiserror = { version = "2.0.3", default-features = false }
2525
url = { version = "2.5.0", default-features = false, features = ["std"] }
26-
pyo3 = { version = "0.25", optional = true, default-features = false, features = ["macros"] }
26+
pyo3 = { version = "0.27.2", optional = true, default-features = false, features = ["macros"] }
2727

2828
[dev-dependencies]
2929
env_logger = "0.10"

datadog-ffe/src/rules_based/attributes.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ mod pyo3_impl {
6969
exceptions::PyTypeError,
7070
prelude::*,
7171
types::{PyBool, PyFloat, PyInt, PyString},
72+
Borrowed,
7273
};
7374

7475
/// Convert Python value to Attribute.
@@ -81,9 +82,11 @@ mod pyo3_impl {
8182
/// - `NoneType`
8283
///
8384
/// Note that nesting is not currently supported and will throw an error.
84-
impl<'py> FromPyObject<'py> for Attribute {
85+
impl<'a, 'py> FromPyObject<'a, 'py> for Attribute {
86+
type Error = PyErr;
87+
8588
#[inline]
86-
fn extract_bound(value: &Bound<'py, PyAny>) -> PyResult<Self> {
89+
fn extract(value: Borrowed<'a, 'py, PyAny>) -> PyResult<Self> {
8790
if let Ok(s) = value.downcast::<PyString>() {
8891
return Ok(Attribute(AttributeImpl::String(s.to_cow()?.into())));
8992
}

datadog-ffe/src/rules_based/eval/evaluation_context.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl EvaluationContext {
5151
mod pyo3_impl {
5252
use super::*;
5353

54-
use pyo3::{intern, prelude::*, types::PyDict};
54+
use pyo3::{intern, prelude::*, types::PyDict, Borrowed};
5555

5656
/// Accepts either a dict with `"targeting_key"` and `"attributes"` items, or any object with
5757
/// `targeting_key` and `attributes` attributes.
@@ -70,9 +70,11 @@ mod pyo3_impl {
7070
///
7171
/// EvaluationContext(targeting_key="user1", attributes={"attr1": 42})
7272
/// ```
73-
impl<'py> FromPyObject<'py> for EvaluationContext {
73+
impl<'a, 'py> FromPyObject<'a, 'py> for EvaluationContext {
74+
type Error = PyErr;
75+
7476
#[inline]
75-
fn extract_bound(value: &Bound<'py, PyAny>) -> PyResult<Self> {
77+
fn extract(value: Borrowed<'a, 'py, PyAny>) -> PyResult<Self> {
7678
let py = value.py();
7779

7880
let (targeting_key, attributes) = if let Ok(dict) = value.downcast::<PyDict>() {

datadog-ffe/src/rules_based/str.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,13 @@ mod pyo3_impl {
118118

119119
use super::*;
120120

121-
use pyo3::{prelude::*, types::PyString};
121+
use pyo3::{prelude::*, types::PyString, Borrowed};
122+
123+
impl<'a, 'py> FromPyObject<'a, 'py> for Str {
124+
type Error = PyErr;
122125

123-
impl<'py> FromPyObject<'py> for Str {
124126
#[inline]
125-
fn extract_bound(value: &Bound<'py, PyAny>) -> PyResult<Self> {
127+
fn extract(value: Borrowed<'a, 'py, PyAny>) -> PyResult<Self> {
126128
let s = value.downcast::<PyString>()?;
127129
Ok(Str::from(s.to_cow()?))
128130
}

0 commit comments

Comments
 (0)