Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to the new bound API of pyo3 0.23 #30

Merged
merged 3 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ jobs:
strategy:
matrix:
include:
- python-version: 3.7
python-release: v3.7
python-impl: CPython
- python-version: 3.8
python-release: v3.8
python-impl: CPython
Expand Down
2 changes: 1 addition & 1 deletion example/hello/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build = "build.rs"
publish = false

[dependencies]
pyo3 = "0.21.1"
pyo3 = "0.23.3"
pyo3-built = { path = "../.." }

[build-dependencies]
Expand Down
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
macro_rules! pyo3_built {
($py: ident, $info: ident, $dict: ident, "build") => {
// Rustc
let build = PyDict::new_bound($py);
let build = PyDict::new($py);
build.set_item("rustc", $info::RUSTC)?;
build.set_item("rustc-version", $info::RUSTC_VERSION)?;
build.set_item("opt-level", $info::OPT_LEVEL)?;
Expand All @@ -14,13 +14,13 @@ macro_rules! pyo3_built {
};
($py: ident, $info: ident, $dict: ident, "time") => {
let dt = $py
.import_bound("email.utils")?
.import("email.utils")?
.call_method1("parsedate_to_datetime", ($info::BUILT_TIME_UTC,))?;
$dict.set_item("info-time", dt)?;
};
($py: ident, $info: ident, $dict: ident, "deps") => {
// info dependencies
let deps = PyDict::new_bound($py);
let deps = PyDict::new($py);
for (name, version) in $info::DEPENDENCIES.iter() {
deps.set_item(name, version)?;
}
Expand All @@ -30,19 +30,19 @@ macro_rules! pyo3_built {
// Features
let features = $info::FEATURES
.iter()
.map(|feat| PyString::new_bound($py, feat))
.map(|feat| PyString::new($py, feat))
.collect::<Vec<_>>();
$dict.set_item("features", features)?;
};
($py: ident, $info: ident, $dict: ident, "host") => {
// Host
let host = PyDict::new_bound($py);
let host = PyDict::new($py);
host.set_item("triple", $info::HOST)?;
$dict.set_item("host", host)?;
};
($py: ident, $info: ident, $dict: ident, "target") => {
// Target
let target = PyDict::new_bound($py);
let target = PyDict::new($py);
target.set_item("arch", $info::CFG_TARGET_ARCH)?;
target.set_item("os", $info::CFG_OS)?;
target.set_item("family", $info::CFG_FAMILY)?;
Expand All @@ -54,7 +54,7 @@ macro_rules! pyo3_built {
$dict.set_item("target", target)?;
};
($py: ident, $info: ident, $dict: ident, "git") => {
let git = PyDict::new_bound($py);
let git = PyDict::new($py);
git.set_item("version", $info::GIT_VERSION)?;
git.set_item("dirty", $info::GIT_DIRTY)?;
git.set_item("hash", $info::GIT_COMMIT_HASH)?;
Expand All @@ -70,7 +70,7 @@ macro_rules! pyo3_built {
($py: ident, $info: ident, $($i:tt ),+ ) => {{
use pyo3::types::PyDict;
use pyo3::types::PyString;
let info = PyDict::new_bound($py);
let info = PyDict::new($py);
$(
pyo3_built!{$py,$info, info, $i}
)+
Expand Down
Loading