Skip to content

Commit cabe787

Browse files
authored
refactor: replace returning pyobject with bound<'p, pyany> in crl::CertificateRevocationList::__getitem__ (#11987)
Signed-off-by: oleg.hoefling <[email protected]>
1 parent 0eedb68 commit cabe787

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Diff for: src/rust/src/x509/crl.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,11 @@ impl CertificateRevocationList {
138138
}
139139
}
140140

141-
fn __getitem__(
141+
fn __getitem__<'p>(
142142
&self,
143-
py: pyo3::Python<'_>,
143+
py: pyo3::Python<'p>,
144144
idx: pyo3::Bound<'_, pyo3::PyAny>,
145-
) -> pyo3::PyResult<pyo3::PyObject> {
145+
) -> pyo3::PyResult<pyo3::Bound<'p, pyo3::PyAny>> {
146146
self.revoked_certs.get_or_init(py, || {
147147
let mut revoked_certs = vec![];
148148
let mut it = self.__iter__();
@@ -161,7 +161,7 @@ impl CertificateRevocationList {
161161
let revoked_cert = pyo3::Bound::new(py, self.revoked_cert(py, i as usize))?;
162162
result.append(revoked_cert)?;
163163
}
164-
Ok(result.into_any().unbind())
164+
Ok(result.into_any())
165165
} else {
166166
let mut idx = idx.extract::<isize>()?;
167167
if idx < 0 {
@@ -170,9 +170,7 @@ impl CertificateRevocationList {
170170
if idx >= (self.len() as isize) || idx < 0 {
171171
return Err(pyo3::exceptions::PyIndexError::new_err(()));
172172
}
173-
Ok(pyo3::Bound::new(py, self.revoked_cert(py, idx as usize))?
174-
.into_any()
175-
.unbind())
173+
Ok(pyo3::Bound::new(py, self.revoked_cert(py, idx as usize))?.into_any())
176174
}
177175
}
178176

0 commit comments

Comments
 (0)