mirror of
https://github.com/saymrwulf/cryptography.git
synced 2026-05-14 20:37:55 +00:00
Avoid allocating a Vec -- directly create a list (#10217)
This commit is contained in:
parent
39e3011170
commit
8d3b4b57bf
1 changed files with 8 additions and 4 deletions
|
|
@ -211,12 +211,12 @@ impl PyServerVerifier {
|
|||
self.as_policy().max_chain_depth
|
||||
}
|
||||
|
||||
fn verify(
|
||||
fn verify<'p>(
|
||||
&self,
|
||||
py: pyo3::Python<'_>,
|
||||
py: pyo3::Python<'p>,
|
||||
leaf: pyo3::Py<PyCertificate>,
|
||||
intermediates: Vec<pyo3::Py<PyCertificate>>,
|
||||
) -> CryptographyResult<Vec<pyo3::Py<PyCertificate>>> {
|
||||
) -> CryptographyResult<&'p pyo3::types::PyList> {
|
||||
let policy = self.as_policy();
|
||||
let store = self.store.get();
|
||||
|
||||
|
|
@ -236,7 +236,11 @@ impl PyServerVerifier {
|
|||
)
|
||||
.map_err(|e| VerificationError::new_err(format!("validation failed: {e:?}")))?;
|
||||
|
||||
Ok(chain.iter().map(|c| c.extra().clone_ref(py)).collect())
|
||||
let result = pyo3::types::PyList::empty(py);
|
||||
for c in chain {
|
||||
result.append(c.extra())?;
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue