diff python/src/lib.rs @ 775:28d8b892fd06

Python: Upgrade pyo3 from 0.17 to 0.26
author Link Mauve <linkmauve@linkmauve.fr>
date Mon, 13 Oct 2025 17:44:38 +0000
parents 7492d384d122
children 816e1f01d650
line wrap: on
line diff
--- a/python/src/lib.rs
+++ b/python/src/lib.rs
@@ -31,16 +31,18 @@
         self.inner.list_files().cloned().collect()
     }
 
-    fn get_file(&mut self, py: Python, name: &str) -> PyObject {
+    fn get_file(&mut self, py: Python, name: &str) -> Py<PyAny> {
         let data = self.inner.get_file(name, true).unwrap();
-        PyBytes::new(py, &data).into_py(py)
+        PyBytes::new(py, &data).into()
     }
 }
 
 #[pymodule]
-fn libtouhou(py: Python, m: &PyModule) -> PyResult<()> {
-    m.add_class::<PBG3>()?;
+mod libtouhou {
+    #[pymodule_export]
+    use super::PBG3;
+
     #[cfg(feature = "glide")]
-    m.add_submodule(glide::module(py)?)?;
-    Ok(())
+    #[pymodule_export]
+    use super::glide::module;
 }