Skip to content

Commit 189a5cf

Browse files
redmiealthonos
andauthored
Migrate to the new bound API of pyo3 0.23 (#30)
* Migrate to the new bound API of pyo3 0.23 * Bump example folder pyo3 version for tests * Remove test for Python 3.7 from `test.yml` Actions worfklow --------- Co-authored-by: Martin Larralde <[email protected]>
1 parent 0c71144 commit 189a5cf

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ jobs:
1313
strategy:
1414
matrix:
1515
include:
16-
- python-version: 3.7
17-
python-release: v3.7
18-
python-impl: CPython
1916
- python-version: 3.8
2017
python-release: v3.8
2118
python-impl: CPython

example/hello/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build = "build.rs"
66
publish = false
77

88
[dependencies]
9-
pyo3 = "0.21.1"
9+
pyo3 = "0.23.3"
1010
pyo3-built = { path = "../.." }
1111

1212
[build-dependencies]

src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
macro_rules! pyo3_built {
55
($py: ident, $info: ident, $dict: ident, "build") => {
66
// Rustc
7-
let build = PyDict::new_bound($py);
7+
let build = PyDict::new($py);
88
build.set_item("rustc", $info::RUSTC)?;
99
build.set_item("rustc-version", $info::RUSTC_VERSION)?;
1010
build.set_item("opt-level", $info::OPT_LEVEL)?;
@@ -14,13 +14,13 @@ macro_rules! pyo3_built {
1414
};
1515
($py: ident, $info: ident, $dict: ident, "time") => {
1616
let dt = $py
17-
.import_bound("email.utils")?
17+
.import("email.utils")?
1818
.call_method1("parsedate_to_datetime", ($info::BUILT_TIME_UTC,))?;
1919
$dict.set_item("info-time", dt)?;
2020
};
2121
($py: ident, $info: ident, $dict: ident, "deps") => {
2222
// info dependencies
23-
let deps = PyDict::new_bound($py);
23+
let deps = PyDict::new($py);
2424
for (name, version) in $info::DEPENDENCIES.iter() {
2525
deps.set_item(name, version)?;
2626
}
@@ -30,19 +30,19 @@ macro_rules! pyo3_built {
3030
// Features
3131
let features = $info::FEATURES
3232
.iter()
33-
.map(|feat| PyString::new_bound($py, feat))
33+
.map(|feat| PyString::new($py, feat))
3434
.collect::<Vec<_>>();
3535
$dict.set_item("features", features)?;
3636
};
3737
($py: ident, $info: ident, $dict: ident, "host") => {
3838
// Host
39-
let host = PyDict::new_bound($py);
39+
let host = PyDict::new($py);
4040
host.set_item("triple", $info::HOST)?;
4141
$dict.set_item("host", host)?;
4242
};
4343
($py: ident, $info: ident, $dict: ident, "target") => {
4444
// Target
45-
let target = PyDict::new_bound($py);
45+
let target = PyDict::new($py);
4646
target.set_item("arch", $info::CFG_TARGET_ARCH)?;
4747
target.set_item("os", $info::CFG_OS)?;
4848
target.set_item("family", $info::CFG_FAMILY)?;
@@ -54,7 +54,7 @@ macro_rules! pyo3_built {
5454
$dict.set_item("target", target)?;
5555
};
5656
($py: ident, $info: ident, $dict: ident, "git") => {
57-
let git = PyDict::new_bound($py);
57+
let git = PyDict::new($py);
5858
git.set_item("version", $info::GIT_VERSION)?;
5959
git.set_item("dirty", $info::GIT_DIRTY)?;
6060
git.set_item("hash", $info::GIT_COMMIT_HASH)?;
@@ -70,7 +70,7 @@ macro_rules! pyo3_built {
7070
($py: ident, $info: ident, $($i:tt ),+ ) => {{
7171
use pyo3::types::PyDict;
7272
use pyo3::types::PyString;
73-
let info = PyDict::new_bound($py);
73+
let info = PyDict::new($py);
7474
$(
7575
pyo3_built!{$py,$info, info, $i}
7676
)+

0 commit comments

Comments
 (0)