summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Fennell <matthew@fennell.dev>2025-10-13 19:53:12 +0100
committerMatthew Fennell <matthew@fennell.dev>2025-11-02 00:51:50 +0000
commit2efa6d7afb821650f69638f8e14640ef2761276d (patch)
treeab0cbd0981a348ded6fed2ded571d7373fc70953
parent7d7a15dcd237d701a5a5a3324f816c272eb39a3c (diff)
Fix deprecations
-rw-r--r--debian/patches/0002-Migrate-from-GIL-Refs-API-to-Bound-T.patch23
-rw-r--r--debian/patches/0003-Explicitly-document-trailing-optional-arguments.patch35
-rw-r--r--debian/patches/series2
3 files changed, 60 insertions, 0 deletions
diff --git a/debian/patches/0002-Migrate-from-GIL-Refs-API-to-Bound-T.patch b/debian/patches/0002-Migrate-from-GIL-Refs-API-to-Bound-T.patch
new file mode 100644
index 0000000..2e00f45
--- /dev/null
+++ b/debian/patches/0002-Migrate-from-GIL-Refs-API-to-Bound-T.patch
@@ -0,0 +1,23 @@
+From: Matthew Fennell <matthew@fennell.dev>
+Date: Mon, 13 Oct 2025 19:50:40 +0100
+Subject: Migrate from GIL Refs API to Bound<T>
+
+See
+https://pyo3.rs/v0.26.0/migration#migrating-from-the-gil-refs-api-to-boundt.
+---
+ src/lib.rs | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/lib.rs b/src/lib.rs
+index 5ab614c..6c556f7 100644
+--- a/src/lib.rs
++++ b/src/lib.rs
+@@ -12,7 +12,7 @@ mod general;
+ use general::format_body;
+
+ #[pymodule]
+-fn slidge_style_parser(_py: Python, m: &PyModule) -> PyResult<()> {
++fn slidge_style_parser(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
+ m.add_function(wrap_pyfunction!(format_body, m)?)?;
+ m.add_function(wrap_pyfunction!(format_for_matrix, m)?)?;
+ m.add_function(wrap_pyfunction!(format_for_telegram, m)?)?;
diff --git a/debian/patches/0003-Explicitly-document-trailing-optional-arguments.patch b/debian/patches/0003-Explicitly-document-trailing-optional-arguments.patch
new file mode 100644
index 0000000..252b877
--- /dev/null
+++ b/debian/patches/0003-Explicitly-document-trailing-optional-arguments.patch
@@ -0,0 +1,35 @@
+From: Matthew Fennell <matthew@fennell.dev>
+Date: Mon, 13 Oct 2025 19:51:45 +0100
+Subject: Explicitly document trailing optional arguments
+
+See
+https://pyo3.rs/v0.26.0/migration#required-arguments-are-no-longer-accepted-after-optional-arguments.
+---
+ src/matrix.rs | 1 +
+ src/telegram.rs | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/src/matrix.rs b/src/matrix.rs
+index 305dccc..3a59c29 100644
+--- a/src/matrix.rs
++++ b/src/matrix.rs
+@@ -22,6 +22,7 @@ const SINGLE_TAGS: &[(&'static str, &'static str)] = &[
+ ];
+
+ #[pyfunction]
++#[pyo3(signature = (body, mentions=None))]
+ pub fn format_for_matrix(body: String, mentions: Option<Vec<(String, usize, usize)>>) -> PyResult<String> {
+ let mut chars: Vec<char> = body.chars().collect();
+ if chars.len() < 1 {
+diff --git a/src/telegram.rs b/src/telegram.rs
+index c369744..dbd8825 100644
+--- a/src/telegram.rs
++++ b/src/telegram.rs
+@@ -13,6 +13,7 @@ const TELEGRAM_STYLES: &[(&'static str, &'static str)] = &[
+ ];
+
+ #[pyfunction]
++#[pyo3(signature = (body, mentions=None))]
+ pub fn format_for_telegram(body: String, mentions: Option<Vec<(String, usize, usize)>>) -> PyResult<(String, Vec<(String, usize, usize, String)>)> {
+ let mut chars: Vec<char> = body.chars().collect();
+ if chars.len() < 1 {
diff --git a/debian/patches/series b/debian/patches/series
index 5dde5de..843e1c8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
0001-Allow-later-versions-of-pyo3-in-Cargo.toml.patch
+0002-Migrate-from-GIL-Refs-API-to-Bound-T.patch
+0003-Explicitly-document-trailing-optional-arguments.patch