Skip to content

Commit be30598

Browse files
committed
Update to PyO3 0.20.
1 parent 24b04b5 commit be30598

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ autoexamples = false
1414

1515
[dependencies]
1616
inline-python-macros = { version = "=0.12.0", path = "./macros" }
17-
pyo3 = { version = "0.19", default-features = false, features = ["auto-initialize"] }
17+
pyo3 = { version = "0.20", default-features = false, features = ["auto-initialize"] }
1818

1919
[workspace]
2020
members = ["examples", "ct-python"]

examples/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ path = "rust-fn.rs"
1717

1818
[dependencies]
1919
inline-python = { path = ".." }
20-
pyo3 = "0.19"
20+
pyo3 = "0.20"

macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ proc_macro = true
1616
[dependencies]
1717
proc-macro2 = { version = "1.0", features = ["span-locations"] }
1818
quote = "1.0"
19-
pyo3 = { version = "0.19", default-features = false, features = ["auto-initialize"] }
19+
pyo3 = { version = "0.20", default-features = false, features = ["auto-initialize"] }
2020

2121
[target.'cfg(unix)'.dependencies]
2222
libc = "0.2.71"

macros/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ extern crate proc_macro;
77
use self::embed_python::EmbedPython;
88
use proc_macro::{Span, TokenStream as TokenStream1};
99
use proc_macro2::{Literal, TokenStream};
10-
use pyo3::{ffi, types::PyBytes, AsPyPointer, FromPyPointer, PyObject, Python};
10+
use pyo3::{ffi, types::PyBytes, FromPyPointer, PyObject, Python};
1111
use quote::quote;
1212
use std::ffi::CString;
1313

macros/src/run.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::error::compile_error_msg;
22
use proc_macro2::TokenStream;
3-
use pyo3::{ffi, AsPyPointer, PyObject, PyResult, Python};
3+
use pyo3::{ffi, PyObject, PyResult, Python};
44
use std::str::FromStr;
55

66
#[cfg(unix)]
@@ -34,7 +34,7 @@ fn run_and_capture(py: Python, code: PyObject) -> PyResult<String> {
3434
let io = py.import("io")?;
3535

3636
let stdout = io.getattr("StringIO")?.call0()?;
37-
let original_stdout = sys.dict().get_item("stdout");
37+
let original_stdout = sys.dict().get_item("stdout")?;
3838
sys.dict().set_item("stdout", stdout)?;
3939

4040
let result =

src/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ impl Context {
9494
/// This function panics if the variable doesn't exist, or the conversion fails.
9595
pub fn get_with_gil<'p, T: FromPyObject<'p>>(&'p self, py: Python<'p>, name: &str) -> T {
9696
match self.globals(py).get_item(name) {
97-
None => panic!("Python context does not contain a variable named `{}`", name),
98-
Some(value) => match FromPyObject::extract(value) {
97+
Err(_) | Ok(None) => panic!("Python context does not contain a variable named `{}`", name),
98+
Ok(Some(value)) => match FromPyObject::extract(value) {
9999
Ok(value) => value,
100100
Err(e) => {
101101
e.print(py);

src/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::Context;
2-
use pyo3::{ffi, types::PyAny, AsPyPointer, PyObject, PyResult, Python};
2+
use pyo3::{ffi, types::PyAny, PyObject, PyResult, Python};
33

44
pub fn run_python_code<'p>(py: Python<'p>, context: &Context, bytecode: &[u8]) -> PyResult<&'p PyAny> {
55
unsafe {

0 commit comments

Comments
 (0)