From b2f70675c8173b1dd4cb242f1550116e09589c60 Mon Sep 17 00:00:00 2001 From: "oleg.hoefling" Date: Sat, 16 Nov 2024 23:43:07 +0100 Subject: [PATCH] refactor: replace returning pyobject with bound<'p, pyany> in x509::certificate::parse_distribution_point_reasons Signed-off-by: oleg.hoefling --- src/rust/src/x509/certificate.rs | 10 +++++----- src/rust/src/x509/crl.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/rust/src/x509/certificate.rs b/src/rust/src/x509/certificate.rs index 1eb8eec4ab9d..ac555d6c35d1 100644 --- a/src/rust/src/x509/certificate.rs +++ b/src/rust/src/x509/certificate.rs @@ -642,10 +642,10 @@ pub(crate) fn parse_distribution_points( Ok(py_dps.into_any().unbind()) } -pub(crate) fn parse_distribution_point_reasons( - py: pyo3::Python<'_>, +pub(crate) fn parse_distribution_point_reasons<'p>( + py: pyo3::Python<'p>, reasons: Option<&asn1::BitString<'_>>, -) -> Result { +) -> CryptographyResult> { let reason_bit_mapping = types::REASON_BIT_MAPPING.get(py)?; Ok(match reasons { @@ -656,9 +656,9 @@ pub(crate) fn parse_distribution_point_reasons( vec.push(reason_bit_mapping.get_item(i)?); } } - pyo3::types::PyFrozenSet::new(py, &vec)?.into_any().unbind() + pyo3::types::PyFrozenSet::new(py, &vec)?.into_any() } - None => py.None(), + None => py.None().into_bound(py), }) } diff --git a/src/rust/src/x509/crl.rs b/src/rust/src/x509/crl.rs index 8c8d9ceca6d2..e2d307e8ee8b 100644 --- a/src/rust/src/x509/crl.rs +++ b/src/rust/src/x509/crl.rs @@ -363,7 +363,7 @@ impl CertificateRevocationList { Some(reasons.unwrap_read()), )? } else { - py.None() + py.None().into_bound(py) }; Ok(Some(types::ISSUING_DISTRIBUTION_POINT.get(py)?.call1(( full_name,