From 11e92173875d643dc27e73617d5234d1ea1c98fb Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 28 Nov 2023 21:31:45 -0500 Subject: [PATCH] Refer to GILOnceCell via the proper module (#9939) It's been in sync since 0.19 --- src/rust/src/backend/cipher_registry.rs | 4 ++-- src/rust/src/types.rs | 4 ++-- src/rust/src/x509/certificate.rs | 4 ++-- src/rust/src/x509/common.rs | 2 +- src/rust/src/x509/crl.rs | 16 ++++++++-------- src/rust/src/x509/csr.rs | 4 ++-- src/rust/src/x509/ocsp_req.rs | 4 ++-- src/rust/src/x509/ocsp_resp.rs | 10 +++++----- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/rust/src/backend/cipher_registry.rs b/src/rust/src/backend/cipher_registry.rs index 76547b189308..9b5013e4a32f 100644 --- a/src/rust/src/backend/cipher_registry.rs +++ b/src/rust/src/backend/cipher_registry.rs @@ -88,8 +88,8 @@ impl<'p> RegisteryBuilder<'p> { fn get_cipher_registry( py: pyo3::Python<'_>, ) -> CryptographyResult<&HashMap> { - static REGISTRY: pyo3::once_cell::GILOnceCell> = - pyo3::once_cell::GILOnceCell::new(); + static REGISTRY: pyo3::sync::GILOnceCell> = + pyo3::sync::GILOnceCell::new(); REGISTRY.get_or_try_init(py, || { let mut m = RegisteryBuilder::new(py); diff --git a/src/rust/src/types.rs b/src/rust/src/types.rs index 1ee030a40f9b..1719c6a535fe 100644 --- a/src/rust/src/types.rs +++ b/src/rust/src/types.rs @@ -5,7 +5,7 @@ pub struct LazyPyImport { module: &'static str, names: &'static [&'static str], - value: pyo3::once_cell::GILOnceCell, + value: pyo3::sync::GILOnceCell, } impl LazyPyImport { @@ -13,7 +13,7 @@ impl LazyPyImport { LazyPyImport { module, names, - value: pyo3::once_cell::GILOnceCell::new(), + value: pyo3::sync::GILOnceCell::new(), } } diff --git a/src/rust/src/x509/certificate.rs b/src/rust/src/x509/certificate.rs index fac37c400454..52f82a1ce5db 100644 --- a/src/rust/src/x509/certificate.rs +++ b/src/rust/src/x509/certificate.rs @@ -38,7 +38,7 @@ self_cell::self_cell!( #[pyo3::prelude::pyclass(frozen, module = "cryptography.hazmat.bindings._rust.x509")] pub(crate) struct Certificate { pub(crate) raw: OwnedCertificate, - pub(crate) cached_extensions: pyo3::once_cell::GILOnceCell, + pub(crate) cached_extensions: pyo3::sync::GILOnceCell, } #[pyo3::prelude::pymethods] @@ -388,7 +388,7 @@ fn load_der_x509_certificate( Ok(Certificate { raw, - cached_extensions: pyo3::once_cell::GILOnceCell::new(), + cached_extensions: pyo3::sync::GILOnceCell::new(), }) } diff --git a/src/rust/src/x509/common.rs b/src/rust/src/x509/common.rs index d541a27b8fc9..98f0a528baf5 100644 --- a/src/rust/src/x509/common.rs +++ b/src/rust/src/x509/common.rs @@ -359,7 +359,7 @@ pub(crate) fn parse_and_cache_extensions< F: Fn(&Extension<'_>) -> Result, CryptographyError>, >( py: pyo3::Python<'p>, - cached_extensions: &pyo3::once_cell::GILOnceCell, + cached_extensions: &pyo3::sync::GILOnceCell, raw_extensions: &Option>, parse_ext: F, ) -> pyo3::PyResult { diff --git a/src/rust/src/x509/crl.rs b/src/rust/src/x509/crl.rs index bdea230a3898..3d782c46b06b 100644 --- a/src/rust/src/x509/crl.rs +++ b/src/rust/src/x509/crl.rs @@ -42,8 +42,8 @@ fn load_der_x509_crl( Ok(CertificateRevocationList { owned: Arc::new(owned), - revoked_certs: pyo3::once_cell::GILOnceCell::new(), - cached_extensions: pyo3::once_cell::GILOnceCell::new(), + revoked_certs: pyo3::sync::GILOnceCell::new(), + cached_extensions: pyo3::sync::GILOnceCell::new(), }) } @@ -75,8 +75,8 @@ self_cell::self_cell!( struct CertificateRevocationList { owned: Arc, - revoked_certs: pyo3::once_cell::GILOnceCell>, - cached_extensions: pyo3::once_cell::GILOnceCell, + revoked_certs: pyo3::sync::GILOnceCell>, + cached_extensions: pyo3::sync::GILOnceCell, } impl CertificateRevocationList { @@ -87,7 +87,7 @@ impl CertificateRevocationList { fn revoked_cert(&self, py: pyo3::Python<'_>, idx: usize) -> RevokedCertificate { RevokedCertificate { owned: self.revoked_certs.get(py).unwrap()[idx].clone(), - cached_extensions: pyo3::once_cell::GILOnceCell::new(), + cached_extensions: pyo3::sync::GILOnceCell::new(), } } @@ -375,7 +375,7 @@ impl CertificateRevocationList { match owned { Ok(o) => Ok(Some(RevokedCertificate { owned: o, - cached_extensions: pyo3::once_cell::GILOnceCell::new(), + cached_extensions: pyo3::sync::GILOnceCell::new(), })), Err(()) => Ok(None), } @@ -464,7 +464,7 @@ impl CRLIterator { .ok()?; Some(RevokedCertificate { owned: revoked, - cached_extensions: pyo3::once_cell::GILOnceCell::new(), + cached_extensions: pyo3::sync::GILOnceCell::new(), }) } } @@ -492,7 +492,7 @@ impl Clone for OwnedRevokedCertificate { #[pyo3::prelude::pyclass(frozen, module = "cryptography.hazmat.bindings._rust.x509")] struct RevokedCertificate { owned: OwnedRevokedCertificate, - cached_extensions: pyo3::once_cell::GILOnceCell, + cached_extensions: pyo3::sync::GILOnceCell, } #[pyo3::prelude::pymethods] diff --git a/src/rust/src/x509/csr.rs b/src/rust/src/x509/csr.rs index 6adb7abb4c3d..431a3e46c34f 100644 --- a/src/rust/src/x509/csr.rs +++ b/src/rust/src/x509/csr.rs @@ -25,7 +25,7 @@ self_cell::self_cell!( #[pyo3::prelude::pyclass(frozen, module = "cryptography.hazmat.bindings._rust.x509")] struct CertificateSigningRequest { raw: OwnedCsr, - cached_extensions: pyo3::once_cell::GILOnceCell, + cached_extensions: pyo3::sync::GILOnceCell, } #[pyo3::prelude::pymethods] @@ -256,7 +256,7 @@ fn load_der_x509_csr( Ok(CertificateSigningRequest { raw, - cached_extensions: pyo3::once_cell::GILOnceCell::new(), + cached_extensions: pyo3::sync::GILOnceCell::new(), }) } diff --git a/src/rust/src/x509/ocsp_req.rs b/src/rust/src/x509/ocsp_req.rs index 97547097d09e..b5688ba77dd1 100644 --- a/src/rust/src/x509/ocsp_req.rs +++ b/src/rust/src/x509/ocsp_req.rs @@ -45,7 +45,7 @@ fn load_der_ocsp_request( Ok(OCSPRequest { raw, - cached_extensions: pyo3::once_cell::GILOnceCell::new(), + cached_extensions: pyo3::sync::GILOnceCell::new(), }) } @@ -53,7 +53,7 @@ fn load_der_ocsp_request( struct OCSPRequest { raw: OwnedOCSPRequest, - cached_extensions: pyo3::once_cell::GILOnceCell, + cached_extensions: pyo3::sync::GILOnceCell, } impl OCSPRequest { diff --git a/src/rust/src/x509/ocsp_resp.rs b/src/rust/src/x509/ocsp_resp.rs index f4251089d69a..0f44afd89514 100644 --- a/src/rust/src/x509/ocsp_resp.rs +++ b/src/rust/src/x509/ocsp_resp.rs @@ -57,8 +57,8 @@ fn load_der_ocsp_response( }; Ok(OCSPResponse { raw: Arc::new(raw), - cached_extensions: pyo3::once_cell::GILOnceCell::new(), - cached_single_extensions: pyo3::once_cell::GILOnceCell::new(), + cached_extensions: pyo3::sync::GILOnceCell::new(), + cached_single_extensions: pyo3::sync::GILOnceCell::new(), }) } @@ -74,8 +74,8 @@ self_cell::self_cell!( struct OCSPResponse { raw: Arc, - cached_extensions: pyo3::once_cell::GILOnceCell, - cached_single_extensions: pyo3::once_cell::GILOnceCell, + cached_extensions: pyo3::sync::GILOnceCell, + cached_single_extensions: pyo3::sync::GILOnceCell, } impl OCSPResponse { @@ -243,7 +243,7 @@ impl OCSPResponse { py, x509::certificate::Certificate { raw: raw_cert, - cached_extensions: pyo3::once_cell::GILOnceCell::new(), + cached_extensions: pyo3::sync::GILOnceCell::new(), }, )?)?; }