mirror of
https://github.com/mii443/tokenizers.git
synced 2025-08-23 00:35:35 +00:00
Unsound call of set_var
(#1664)
* refactor: lift cloning to caller * refactor: do not elide lifetimes as in Rust 2018 * fix: unsound use of env::set_var, was breaking stdlib change to make unsafe It is generally not safe to set env variables. The correct way to set a config value that needs to be overridden is to hold a copy internal to the library and only read from the environment.
This commit is contained in:
@ -553,7 +553,7 @@ impl tk::tokenizer::Normalizer for CustomNormalizer {
|
||||
Python::with_gil(|py| {
|
||||
let normalized = PyNormalizedStringRefMut::new(normalized);
|
||||
let py_normalized = self.inner.bind(py);
|
||||
py_normalized.call_method("normalize", (normalized.get(),), None)?;
|
||||
py_normalized.call_method("normalize", (normalized.get().clone(),), None)?;
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user