Skip to content

Commit

Permalink
refactor: replace returning pyobject with bound<'p, pyany> in x509::c…
Browse files Browse the repository at this point in the history
…ertificate::parse_distribution_point_reasons

Signed-off-by: oleg.hoefling <[email protected]>
  • Loading branch information
hoefling committed Nov 16, 2024
1 parent b7def98 commit b2f7067
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/rust/src/x509/certificate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<pyo3::PyObject, CryptographyError> {
) -> CryptographyResult<pyo3::Bound<'p, pyo3::PyAny>> {
let reason_bit_mapping = types::REASON_BIT_MAPPING.get(py)?;

Ok(match reasons {
Expand All @@ -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),
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/x509/crl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b2f7067

Please sign in to comment.