diff options
author | Erik Johnston <erikj@element.io> | 2024-05-08 14:30:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-08 14:30:06 +0100 |
commit | 414ddcd45722be8a4a3f70d4b52c3b81be79118f (patch) | |
tree | c88190f9f3d7c2f9749589ba8c729d19d1e0c7a1 /rust/src/acl/mod.rs | |
parent | Note preset behaviour in `autocreate_auto_join_room_preset` docs (#17150) (diff) | |
download | synapse-414ddcd45722be8a4a3f70d4b52c3b81be79118f.tar.xz |
Update PyO3 to 0.21 (#17162)
This version change requires a migration to a new API. See https://pyo3.rs/v0.21.2/migration#from-020-to-021 This will fix the annoying warnings added when using the recent rust nightly: > warning: non-local `impl` definition, they should be avoided as they go against expectation
Diffstat (limited to 'rust/src/acl/mod.rs')
-rw-r--r-- | rust/src/acl/mod.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/rust/src/acl/mod.rs b/rust/src/acl/mod.rs index 286574fb49..982720ba90 100644 --- a/rust/src/acl/mod.rs +++ b/rust/src/acl/mod.rs @@ -25,21 +25,21 @@ use std::net::Ipv4Addr; use std::str::FromStr; use anyhow::Error; -use pyo3::prelude::*; +use pyo3::{prelude::*, pybacked::PyBackedStr}; use regex::Regex; use crate::push::utils::{glob_to_regex, GlobMatchType}; /// Called when registering modules with python. -pub fn register_module(py: Python<'_>, m: &PyModule) -> PyResult<()> { - let child_module = PyModule::new(py, "acl")?; +pub fn register_module(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { + let child_module = PyModule::new_bound(py, "acl")?; child_module.add_class::<ServerAclEvaluator>()?; - m.add_submodule(child_module)?; + m.add_submodule(&child_module)?; // We need to manually add the module to sys.modules to make `from // synapse.synapse_rust import acl` work. - py.import("sys")? + py.import_bound("sys")? .getattr("modules")? .set_item("synapse.synapse_rust.acl", child_module)?; @@ -59,8 +59,8 @@ impl ServerAclEvaluator { #[new] pub fn py_new( allow_ip_literals: bool, - allow: Vec<&str>, - deny: Vec<&str>, + allow: Vec<PyBackedStr>, + deny: Vec<PyBackedStr>, ) -> Result<Self, Error> { let allow = allow .iter() |