Skip to content

Commit e909e43

Browse files
committed
Rollback to pyo3 = { version = "0.16.6", features = ["abi3"] }
In order to avoid `ImportError: PyO3 modules compiled for CPython 3.8 or older may only be initialized once per interpreter process` introduced since pyo3 >= 0.17.0, which only allow each `#[pymodule]` to be initialized once, this PR temporarily rollback to pyo3 = 0.16.6. It also remove the use of `PyUserWarning` which introduced since pyo3 > 0.18.0. See PyO3/pyo3@78ba70d See PyO3/pyo3@1d20f2a Fixes #694 Signed-off-by: Wong Hoi Sing Edison <[email protected]>
1 parent accb0ba commit e909e43

File tree

3 files changed

+17
-46
lines changed

3 files changed

+17
-46
lines changed

src/_bcrypt/Cargo.lock

+16-33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/_bcrypt/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2018"
66
publish = false
77

88
[dependencies]
9-
pyo3 = { version = "0.20.1", features = ["abi3"] }
9+
pyo3 = { version = "0.16.6", features = ["abi3"] }
1010
bcrypt = "0.15"
1111
bcrypt-pbkdf = "0.10.0"
1212
base64 = "0.21.5"

src/_bcrypt/src/lib.rs

-12
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,6 @@ fn kdf<'p>(
151151
));
152152
}
153153

154-
if rounds < 50 && !ignore_few_rounds {
155-
// They probably think bcrypt.kdf()'s rounds parameter is logarithmic,
156-
// expecting this value to be slow enough (it probably would be if this
157-
// were bcrypt). Emit a warning.
158-
pyo3::PyErr::warn(
159-
py,
160-
pyo3::exceptions::PyUserWarning::type_object(py),
161-
&format!("Warning: bcrypt.kdf() called with only {rounds} round(s). This few is not secure: the parameter is linear, like PBKDF2."),
162-
3
163-
)?;
164-
}
165-
166154
pyo3::types::PyBytes::new_with(py, desired_key_bytes, |output| {
167155
py.allow_threads(|| {
168156
bcrypt_pbkdf::bcrypt_pbkdf(password, salt, rounds, output).unwrap();

0 commit comments

Comments
 (0)