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

chore: bump pyo3 to 0.21 #174

Closed
wants to merge 1 commit into from
Closed
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
134 changes: 44 additions & 90 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ default = ["zenoh/default"]
maintenance = { status = "actively-developed" }

[dependencies]
env_logger = "0.10.0"
env_logger = "0.11.3"
flume = "0.11.0"
json5 = "0.4.1"
pyo3 = { version = "0.18.1", features = ["extension-module", "abi3-py37"] }
pyo3 = { version = "0.21.1", features = ["extension-module", "abi3-py37"] }
uhlc = "0.6.0"
validated_struct = "2.1.0"
zenoh = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["unstable"], default-features = false }
Expand Down
25 changes: 11 additions & 14 deletions src/closures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,13 @@ trait CallbackUnwrap {
impl<T> CallbackUnwrap for PyResult<T> {
type Output = T;
fn cb_unwrap(self) -> Self::Output {
match self {
Ok(o) => o,
Err(e) => Python::with_gil(|py| {
if let Some(trace) = e.traceback(py).and_then(|trace| trace.format().ok()) {
panic!("Exception thrown in callback: {}.\n{}", e, trace)
} else {
panic!("Exception thrown in callback: {}.", e,)
}
}),
}
self.unwrap_or_else(|e| Python::with_gil(|py| {
if let Some(trace) = e.traceback_bound(py).and_then(|trace| trace.format().ok()) {
panic!("Exception thrown in callback: {}.\n{}", e, trace)
} else {
panic!("Exception thrown in callback: {}.", e, )
}
}))
}
}

Expand All @@ -47,9 +44,9 @@ pub(crate) struct PyClosure<I> {
pub(crate) drop: Option<Py<PyAny>>,
_marker: std::marker::PhantomData<I>,
}
impl<I> TryFrom<&PyAny> for PyClosure<I> {
impl<I> TryFrom<&Bound<'_, PyAny>> for PyClosure<I> {
type Error = PyErr;
fn try_from(value: &PyAny) -> Result<Self, Self::Error> {
fn try_from(value: &Bound<PyAny>) -> Result<Self, Self::Error> {
Python::with_gil(|py| {
let pycall = match value.getattr("call") {
Ok(value) => value.into_py(py),
Expand Down Expand Up @@ -169,15 +166,15 @@ impl _Queue {
Err(flume::RecvTimeoutError::Disconnected) => break,
Err(flume::RecvTimeoutError::Timeout) => {
let list: Py<PyList> =
Python::with_gil(|py| PyList::new(py, vec).into_py(py));
Python::with_gil(|py| PyList::new_bound(py, vec).into());
return Err(pyo3::exceptions::PyTimeoutError::new_err((list,)));
}
}
}
vec
}
};
Ok(Python::with_gil(|py| PyList::new(py, vec).into_py(py)))
Ok(Python::with_gil(|py| PyList::new_bound(py, vec).into()))
})
}
pub fn is_closed(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl _Config {
pub fn from_json5(expr: &str) -> PyResult<Self> {
match Config::from_deserializer(&mut json5::Deserializer::from_str(expr).to_pyres()?) {
Ok(k) => Ok(Self(PyConfig::Config(Box::new(k)))),
Err(Ok(_)) => Err(zenoh_core::zerror!(
Err(Ok(_)) => Err(zerror!(
"{} did parse into a config, but invalid values were found",
expr,
)
Expand Down
2 changes: 1 addition & 1 deletion src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl _Priority {
}
}
}
impl std::cmp::PartialOrd for _Priority {
impl PartialOrd for _Priority {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
(self.0 as u8).partial_cmp(&(other.0 as u8))
}
Expand Down
Loading