Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ To see unreleased changes, please see the CHANGELOG on the main branch.
Trait `Runtime` now requires `spawn_blocking` function,
`future_into_py` functions now require future return type to be `Send`.
[#60](https://github.com/PyO3/pyo3-async-runtimes/pull/60)
- Change pyo3 `downcast` calls to `cast` calls [#65](https://github.com/PyO3/pyo3-async-runtimes/pull/65)

## [0.26.0] - 2025-09-02

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ fn main() -> PyResult<()> {
assert!(uvloop
.bind(py)
.getattr("Loop")?
.downcast::<PyType>()
.cast::<PyType>()
.unwrap()
.is_instance(&pyo3_async_runtimes::async_std::get_current_loop(py)?)?);
Ok(())
Expand Down
4 changes: 2 additions & 2 deletions pytests/test_async_std_asyncio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ async fn test_cancel() -> PyResult<()> {
assert!(e.value(py).is_instance(
py.import("asyncio")?
.getattr("CancelledError")?
.downcast::<PyType>()
.cast::<PyType>()
.unwrap()
)?);
Ok(())
Expand Down Expand Up @@ -240,7 +240,7 @@ fn test_local_cancel(event_loop: Py<PyAny>) -> PyResult<()> {
assert!(e.value(py).is_instance(
py.import("asyncio")?
.getattr("CancelledError")?
.downcast::<PyType>()
.cast::<PyType>()
.unwrap()
)?);
Ok(())
Expand Down
11 changes: 2 additions & 9 deletions pytests/test_async_std_uvloop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,8 @@ fn main() -> pyo3::PyResult<()> {
pyo3_async_runtimes::async_std::run(py, async move {
// verify that we are on a uvloop.Loop
Python::attach(|py| -> PyResult<()> {
assert!(
pyo3_async_runtimes::async_std::get_current_loop(py)?.is_instance(
uvloop
.bind(py)
.getattr("Loop")?
.downcast::<PyType>()
.unwrap()
)?
);
assert!(pyo3_async_runtimes::async_std::get_current_loop(py)?
.is_instance(uvloop.bind(py).getattr("Loop")?.cast::<PyType>().unwrap())?);
Ok(())
})?;

Expand Down
11 changes: 2 additions & 9 deletions pytests/test_tokio_current_thread_uvloop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,8 @@ fn main() -> pyo3::PyResult<()> {
pyo3_async_runtimes::tokio::run(py, async move {
// verify that we are on a uvloop.Loop
Python::attach(|py| -> PyResult<()> {
assert!(
pyo3_async_runtimes::tokio::get_current_loop(py)?.is_instance(
uvloop
.bind(py)
.getattr("Loop")?
.downcast::<PyType>()
.unwrap()
)?
);
assert!(pyo3_async_runtimes::tokio::get_current_loop(py)?
.is_instance(uvloop.bind(py).getattr("Loop")?.cast::<PyType>().unwrap())?);
Ok(())
})?;

Expand Down
11 changes: 2 additions & 9 deletions pytests/test_tokio_multi_thread_uvloop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,8 @@ fn main() -> pyo3::PyResult<()> {
pyo3_async_runtimes::tokio::run(py, async move {
// verify that we are on a uvloop.Loop
Python::attach(|py| -> PyResult<()> {
assert!(
pyo3_async_runtimes::tokio::get_current_loop(py)?.is_instance(
uvloop
.bind(py)
.getattr("Loop")?
.downcast::<PyType>()
.unwrap()
)?
);
assert!(pyo3_async_runtimes::tokio::get_current_loop(py)?
.is_instance(uvloop.bind(py).getattr("Loop")?.cast::<PyType>().unwrap())?);
Ok(())
})?;

Expand Down
4 changes: 2 additions & 2 deletions pytests/tokio_asyncio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ async fn test_cancel() -> PyResult<()> {
assert!(e.value(py).is_instance(
py.import("asyncio")?
.getattr("CancelledError")?
.downcast::<PyType>()
.cast::<PyType>()
.unwrap()
)?);
Ok(())
Expand Down Expand Up @@ -216,7 +216,7 @@ fn test_local_cancel(event_loop: Py<PyAny>) -> PyResult<()> {
assert!(e.value(py).is_instance(
py.import("asyncio")?
.getattr("CancelledError")?
.downcast::<PyType>()
.cast::<PyType>()
.unwrap()
)?);
Ok(())
Expand Down
Loading