Skip to content

Commit ac3975e

Browse files
author
Andrew J Westlake
committed
Removed deprecation warnings + unused allow(deprecated)
1 parent eae0830 commit ac3975e

File tree

4 files changed

+24
-27
lines changed

4 files changed

+24
-27
lines changed

pytests/test_async_std_asyncio.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ async fn test_cancel() -> PyResult<()> {
149149
.await
150150
{
151151
Python::with_gil(|py| -> PyResult<()> {
152-
assert!(py
153-
.import("asyncio")?
154-
.getattr("CancelledError")?
155-
.downcast::<PyType>()
156-
.unwrap()
157-
.is_instance(e.pvalue(py))?);
152+
assert!(e.value(py).is_instance(
153+
py.import("asyncio")?
154+
.getattr("CancelledError")?
155+
.downcast::<PyType>()
156+
.unwrap()
157+
)?);
158158
Ok(())
159159
})?;
160160
} else {
@@ -195,12 +195,12 @@ fn test_local_cancel(event_loop: PyObject) -> PyResult<()> {
195195
.await
196196
{
197197
Python::with_gil(|py| -> PyResult<()> {
198-
assert!(py
199-
.import("asyncio")?
200-
.getattr("CancelledError")?
201-
.downcast::<PyType>()
202-
.unwrap()
203-
.is_instance(e.pvalue(py))?);
198+
assert!(e.value(py).is_instance(
199+
py.import("asyncio")?
200+
.getattr("CancelledError")?
201+
.downcast::<PyType>()
202+
.unwrap()
203+
)?);
204204
Ok(())
205205
})?;
206206
} else {
@@ -319,7 +319,6 @@ fn test_contextvars() -> PyResult<()> {
319319
})
320320
}
321321

322-
#[allow(deprecated)]
323322
fn main() -> pyo3::PyResult<()> {
324323
pyo3::prepare_freethreaded_python();
325324

pytests/test_tokio_current_thread_asyncio.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ mod tokio_asyncio;
33

44
use pyo3::prelude::*;
55

6-
#[allow(deprecated)]
76
fn main() -> pyo3::PyResult<()> {
87
pyo3::prepare_freethreaded_python();
98

pytests/test_tokio_multi_thread_asyncio.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ mod tokio_asyncio;
33

44
use pyo3::prelude::*;
55

6-
#[allow(deprecated)]
76
fn main() -> pyo3::PyResult<()> {
87
pyo3::prepare_freethreaded_python();
98

pytests/tokio_asyncio/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ async fn test_cancel() -> PyResult<()> {
152152
.await
153153
{
154154
Python::with_gil(|py| -> PyResult<()> {
155-
assert!(py
156-
.import("asyncio")?
157-
.getattr("CancelledError")?
158-
.downcast::<PyType>()
159-
.unwrap()
160-
.is_instance(e.pvalue(py))?);
155+
assert!(e.value(py).is_instance(
156+
py.import("asyncio")?
157+
.getattr("CancelledError")?
158+
.downcast::<PyType>()
159+
.unwrap()
160+
)?);
161161
Ok(())
162162
})?;
163163
} else {
@@ -199,12 +199,12 @@ fn test_local_cancel(event_loop: PyObject) -> PyResult<()> {
199199
.await
200200
{
201201
Python::with_gil(|py| -> PyResult<()> {
202-
assert!(py
203-
.import("asyncio")?
204-
.getattr("CancelledError")?
205-
.downcast::<PyType>()
206-
.unwrap()
207-
.is_instance(e.pvalue(py))?);
202+
assert!(e.value(py).is_instance(
203+
py.import("asyncio")?
204+
.getattr("CancelledError")?
205+
.downcast::<PyType>()
206+
.unwrap()
207+
)?);
208208
Ok(())
209209
})?;
210210
} else {

0 commit comments

Comments
 (0)