Skip to content

mark gil_used = false in all pymodules #13230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/rust/src/asn1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ fn encode_dss_signature<'p>(
Ok(pyo3::types::PyBytes::new(py, &result))
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
#[pyo3(name = "asn1")]
pub(crate) mod asn1_mod {
#[pymodule_export]
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/backend/aead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ impl AesGcmSiv {
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod aead {
#[pymodule_export]
use super::{AesCcm, AesGcm, AesGcmSiv, AesOcb3, AesSiv, ChaCha20Poly1305};
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/backend/ciphers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ fn _advance_aad(ctx: pyo3::Bound<'_, pyo3::PyAny>, n: u64) {
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod ciphers {
#[pymodule_export]
use super::{
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/backend/cmac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl Cmac {
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod cmac {
#[pymodule_export]
use super::Cmac;
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/backend/dh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ impl DHParameterNumbers {
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod dh {
#[pymodule_export]
use super::{
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/backend/dsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ impl DsaParameterNumbers {
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod dsa {
#[pymodule_export]
use super::{
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/backend/ec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ impl EllipticCurvePublicNumbers {
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod ec {
#[pymodule_export]
use super::{
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/backend/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl Ed25519PublicKey {
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod ed25519 {
#[pymodule_export]
use super::{
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/backend/ed448.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl Ed448PublicKey {
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod ed448 {
#[pymodule_export]
use super::{
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/backend/hashes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl XOFHash {
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod hashes {
#[pymodule_export]
use super::{hash_supported, Hash, XOFHash};
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/backend/hmac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl Hmac {
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod hmac {
#[pymodule_export]
use super::Hmac;
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/backend/kdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ impl HkdfExpand {
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod kdf {
#[pymodule_export]
use super::derive_pbkdf2_hmac;
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/backend/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ fn public_key_from_pkey<'p>(
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod keys {
#[pymodule_export]
use super::{
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/backend/poly1305.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl Poly1305 {
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod poly1305 {
#[pymodule_export]
use super::Poly1305;
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/backend/rsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ impl RsaPublicNumbers {
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod rsa {
#[pymodule_export]
use super::{
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/backend/x25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl X25519PublicKey {
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod x25519 {
#[pymodule_export]
use super::{
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/backend/x448.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl X448PublicKey {
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod x448 {
#[pymodule_export]
use super::{
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/exceptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub(crate) fn already_finalized_error() -> CryptographyError {
CryptographyError::from(AlreadyFinalized::new_err("Context was already finalized."))
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod exceptions {
#[pymodule_export]
use super::Reasons;
Expand Down
8 changes: 4 additions & 4 deletions src/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn enable_fips(providers: &mut LoadedProviders) -> CryptographyResult<()> {
Ok(())
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
mod _rust {
use pyo3::types::PyModuleMethods;

Expand All @@ -116,7 +116,7 @@ mod _rust {
#[pymodule_export]
use crate::test_support::test_support;

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
mod x509 {
#[pymodule_export]
use crate::x509::certificate::{
Expand All @@ -143,7 +143,7 @@ mod _rust {
};
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
mod ocsp {
#[pymodule_export]
use crate::x509::ocsp_req::{create_ocsp_request, load_der_ocsp_request, OCSPRequest};
Expand All @@ -153,7 +153,7 @@ mod _rust {
};
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
mod openssl {
use pyo3::prelude::PyModuleMethods;

Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/pkcs12.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ fn load_pkcs12<'p>(
.call1((private_key, cert, additional_certs))?)
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod pkcs12 {
#[pymodule_export]
use super::{
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/pkcs7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ fn load_der_pkcs7_certificates<'p>(
}
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
#[pyo3(name = "pkcs7")]
pub(crate) mod pkcs7_mod {
#[pymodule_export]
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/test_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fn pkcs7_verify(
Ok(())
}

#[pyo3::pymodule]
#[pyo3::pymodule(gil_used = false)]
pub(crate) mod test_support {
#[cfg(not(any(CRYPTOGRAPHY_IS_BORINGSSL, CRYPTOGRAPHY_IS_AWSLC)))]
#[pymodule_export]
Expand Down