From a5aaa9ca4040ee518c9abf4cb5273d5e6cc2c1c4 Mon Sep 17 00:00:00 2001 From: "dependency-automation-app[bot]" <205013149+dependency-automation-app[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 02:08:59 +0000 Subject: [PATCH 1/3] fix(deps): update rust crate pyo3 to 0.29.0 [security] --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index ca965cf..914ef67 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ arraystring = "0.3.0" typenum = "1" [dependencies.pyo3] -version = "0.17.3" +version = "0.29.0" features = ["extension-module"] [profile.release] From 6e029f84205074622068a83291f9d5de6c6fb4f1 Mon Sep 17 00:00:00 2001 From: Jiri Kerestes Date: Wed, 9 Sep 2026 14:57:35 +0200 Subject: [PATCH 2/3] fix(deps): Address PyO3 breaking changes --- src/lib.rs | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9441969..9722b10 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,6 +25,7 @@ struct DomainExtractor { #[pymethods] impl DomainExtractor { #[new] + #[pyo3(signature = (suffix_list=None))] fn new( suffix_list: Option<&str>, ) -> Self { @@ -120,11 +121,11 @@ impl DomainExtractor { } } - fn extract( + fn extract<'py>( &self, - py: Python, - domain: &PyString, - ) -> PyResult { + py: Python<'py>, + domain: &Bound<'_, PyString>, + ) -> PyResult> { if domain.len().unwrap() > 255 { return Err(PyValueError::new_err("Invalid domain detected")); } @@ -139,9 +140,9 @@ impl DomainExtractor { unsafe { let dict = pyo3::ffi::PyDict_New(); for (fraction_key, fraction) in [ - (intern!(py, "suffix").into_ptr(), suffix_part), - (intern!(py, "domain").into_ptr(), domain_part), - (intern!(py, "subdomain").into_ptr(), subdomain_part), + (intern!(py, "suffix").as_ptr(), suffix_part), + (intern!(py, "domain").as_ptr(), domain_part), + (intern!(py, "subdomain").as_ptr(), subdomain_part), ] { if !fraction.is_empty() { let substr = pyo3::ffi::PyUnicode_FromStringAndSize( @@ -159,18 +160,18 @@ impl DomainExtractor { pyo3::ffi::PyDict_SetItem( dict, fraction_key, - intern!(py, "").into_ptr(), + intern!(py, "").as_ptr(), ); } } - Ok(pyo3::PyObject::from_owned_ptr(py, dict)) + Ok(Bound::from_owned_ptr(py, dict)) } } fn is_valid_domain( &self, - domain: &PyString, + domain: &Bound<'_, PyString>, ) -> bool { let domain_len = domain.len().unwrap(); if domain_len == 0 || domain_len > 255 { @@ -221,11 +222,11 @@ impl DomainExtractor { self.tld_list.clone() } - fn extract_from_url( + fn extract_from_url<'py>( &self, - py: Python, - url: &PyString, - ) -> PyResult { + py: Python<'py>, + url: &Bound<'_, PyString>, + ) -> PyResult> { let mut url_str = url.to_str().unwrap(); match memchr::memmem::find(url_str.as_bytes(), b"//") { @@ -268,9 +269,9 @@ impl DomainExtractor { unsafe { let dict = pyo3::ffi::PyDict_New(); for (fraction_key, fraction) in [ - (intern!(py, "suffix").into_ptr(), suffix_part), - (intern!(py, "domain").into_ptr(), domain_part), - (intern!(py, "subdomain").into_ptr(), subdomain_part), + (intern!(py, "suffix").as_ptr(), suffix_part), + (intern!(py, "domain").as_ptr(), domain_part), + (intern!(py, "subdomain").as_ptr(), subdomain_part), ] { if !fraction.is_empty() { let substr = pyo3::ffi::PyUnicode_FromStringAndSize( @@ -288,12 +289,12 @@ impl DomainExtractor { pyo3::ffi::PyDict_SetItem( dict, fraction_key, - intern!(py, "").into_ptr(), + intern!(py, "").as_ptr(), ); } } - Ok(pyo3::PyObject::from_owned_ptr(py, dict)) + Ok(Bound::from_owned_ptr(py, dict)) } } } @@ -353,7 +354,7 @@ fn parse_suffix_list( #[pymodule] fn pydomainextractor( _py: Python, - m: &PyModule, + m: &Bound<'_, PyModule>, ) -> PyResult<()> { m.add_class::()?; Ok(()) From ee9596e1809abb3a52b529c71a597ffbe59043e0 Mon Sep 17 00:00:00 2001 From: Jiri Kerestes Date: Wed, 9 Sep 2026 14:58:15 +0200 Subject: [PATCH 3/3] chore(): Address clippy issues --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 9722b10..7351d7e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -114,7 +114,7 @@ impl DomainExtractor { } else { Ok((domain, "", "")) } - } else if current_suffixes.len() > 0 && current_suffixes.contains_key(current_fraction) { + } else if !current_suffixes.is_empty() && current_suffixes.contains_key(current_fraction) { Ok((domain, "", "")) } else { Ok((suffix_part, current_fraction, ""))