Skip to content

Commit

Permalink
Consistently use wrap_pyfunction_bound (#10821)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Apr 15, 2024
1 parent 1945701 commit ce03d92
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/rust/src/backend/ciphers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,12 +559,12 @@ pub(crate) fn create_module(
py: pyo3::Python<'_>,
) -> pyo3::PyResult<pyo3::Bound<'_, pyo3::prelude::PyModule>> {
let m = pyo3::prelude::PyModule::new_bound(py, "ciphers")?;
m.add_function(pyo3::wrap_pyfunction!(create_encryption_ctx, &m)?)?;
m.add_function(pyo3::wrap_pyfunction!(create_decryption_ctx, &m)?)?;
m.add_function(pyo3::wrap_pyfunction!(cipher_supported, &m)?)?;
m.add_function(pyo3::wrap_pyfunction_bound!(create_encryption_ctx, &m)?)?;
m.add_function(pyo3::wrap_pyfunction_bound!(create_decryption_ctx, &m)?)?;
m.add_function(pyo3::wrap_pyfunction_bound!(cipher_supported, &m)?)?;

m.add_function(pyo3::wrap_pyfunction!(_advance, &m)?)?;
m.add_function(pyo3::wrap_pyfunction!(_advance_aad, &m)?)?;
m.add_function(pyo3::wrap_pyfunction_bound!(_advance, &m)?)?;
m.add_function(pyo3::wrap_pyfunction_bound!(_advance_aad, &m)?)?;

m.add_class::<PyCipherContext>()?;
m.add_class::<PyAEADEncryptionContext>()?;
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 @@ -817,7 +817,7 @@ pub(crate) fn create_module(
py: pyo3::Python<'_>,
) -> pyo3::PyResult<pyo3::Bound<'_, pyo3::prelude::PyModule>> {
let m = pyo3::prelude::PyModule::new_bound(py, "rsa")?;
m.add_function(pyo3::wrap_pyfunction!(generate_private_key, &m)?)?;
m.add_function(pyo3::wrap_pyfunction_bound!(generate_private_key, &m)?)?;

m.add_class::<RsaPrivateKey>()?;
m.add_class::<RsaPublicKey>()?;
Expand Down
7 changes: 5 additions & 2 deletions src/rust/src/pkcs12.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,11 @@ pub(crate) fn create_submodule(
) -> pyo3::PyResult<pyo3::Bound<'_, pyo3::prelude::PyModule>> {
let submod = pyo3::prelude::PyModule::new_bound(py, "pkcs12")?;

submod.add_function(pyo3::wrap_pyfunction!(load_key_and_certificates, &submod)?)?;
submod.add_function(pyo3::wrap_pyfunction!(load_pkcs12, &submod)?)?;
submod.add_function(pyo3::wrap_pyfunction_bound!(
load_key_and_certificates,
&submod
)?)?;
submod.add_function(pyo3::wrap_pyfunction_bound!(load_pkcs12, &submod)?)?;

submod.add_class::<PKCS12Certificate>()?;

Expand Down

0 comments on commit ce03d92

Please sign in to comment.