Skip to content

Commit

Permalink
Use newer pyo3 version.
Browse files Browse the repository at this point in the history
  - From 0.20 to 0.23.
  - Updated to avoid warnings with newer Rust versions.
  - Fix issues introduced by updating pyo3.
  • Loading branch information
AngheloAlf committed Dec 15, 2024
1 parent 6be155b commit 814bdb0
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 182 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
support something that may have broken without anybody noticing.
- Nothing really changed. Just the CI tools I was using are refusing to use
any Python version older than this. Sorry if you were affected by this.
- Use newer pyo3 version.
- From 0.20 to 0.23.
- Updated to avoid warnings with newer Rust versions.
- Fix issues introduced by updating pyo3.

## [2.7.1] - 2024-09-25

Expand Down
150 changes: 13 additions & 137 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ crate-type = ["cdylib", "staticlib", "rlib"]

[dependencies]
regex = "1.10.2"
pyo3 = { version = "0.20.0", optional = true, features = ["abi3", "abi3-py37"]}
pyo3 = { version = "0.23.2", optional = true, features = ["abi3"]}
lazy_static = "1.4.0"
serde = { version = "1.0", features = ["derive"], optional = true }

Expand Down
5 changes: 3 additions & 2 deletions src/rs/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ impl Hash for File {
#[cfg(feature = "python_bindings")]
#[allow(non_snake_case)]
pub(crate) mod python_bindings {
use pyo3::{intern, prelude::*};
use pyo3::{intern, prelude::*, IntoPyObjectExt};

use std::path::PathBuf;

Expand All @@ -395,6 +395,7 @@ pub(crate) mod python_bindings {
#[pymethods]
impl File {
#[new]
#[pyo3(signature = (filepath, vram, size, section_type, vrom=None, align=None))]
fn py_new(
filepath: PathBuf,
vram: u64,
Expand All @@ -416,7 +417,7 @@ pub(crate) mod python_bindings {
let pathlib_path = pathlib.getattr(intern!(py, "Path"))?;
let args = (self.filepath.clone(),);

Ok(pathlib_path.call1(args)?.to_object(py))
pathlib_path.call1(args)?.into_py_any(py)
})
}

Expand Down
1 change: 1 addition & 0 deletions src/rs/found_symbol_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ pub(crate) mod python_bindings {
}

#[pyo3(name = "getAsStrPlusOffset")]
#[pyo3(signature = (sym_name=None))]
fn getAsStrPlusOffset(&self, sym_name: Option<String>) -> String {
let temp = super::FoundSymbolInfo::from(self);
temp.get_as_str_plus_offset(sym_name)
Expand Down
2 changes: 1 addition & 1 deletion src/rs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use pyo3::prelude::*;

#[cfg(feature = "python_bindings")]
#[pymodule]
fn mapfile_parser(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
fn mapfile_parser(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_class::<mapfile::MapFile>()?;
m.add_class::<segment::Segment>()?;
m.add_class::<file::File>()?;
Expand Down
1 change: 1 addition & 0 deletions src/rs/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ pub(crate) mod python_bindings {
#[pymethods]
impl super::Segment {
#[new]
#[pyo3(signature = (name, vram, size, vrom, align=None))]
fn py_new(name: String, vram: u64, size: u64, vrom: u64, align: Option<u64>) -> Self {
Self::new(name, vram, size, vrom, align)
}
Expand Down
Loading

0 comments on commit 814bdb0

Please sign in to comment.