Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron committed Nov 19, 2024
1 parent 72489bb commit 9f0d899
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async fn main() -> PyResult<()> {
let fut = Python::with_gil(|py| {
let asyncio = py.import("asyncio")?;
// convert asyncio.sleep into a Rust Future
pyo3_async_runtimes::async_std::into_future(asyncio.call_method1("sleep", (1.into_py(py),))?)
pyo3_async_runtimes::async_std::into_future(asyncio.call_method1("sleep", (1.into_pyobject(py).unwrap(),))?)
})?;

fut.await?;
Expand Down Expand Up @@ -99,7 +99,7 @@ async fn main() -> PyResult<()> {
let fut = Python::with_gil(|py| {
let asyncio = py.import("asyncio")?;
// convert asyncio.sleep into a Rust Future
pyo3_async_runtimes::tokio::into_future(asyncio.call_method1("sleep", (1.into_py(py),))?)
pyo3_async_runtimes::tokio::into_future(asyncio.call_method1("sleep", (1.into_pyobject(py).unwrap(),))?)
})?;

fut.await?;
Expand Down Expand Up @@ -363,7 +363,7 @@ async fn main() -> PyResult<()> {
// convert asyncio.sleep into a Rust Future
pyo3_async_runtimes::async_std::into_future(
asyncio.call_method1("sleep", (1.into_py(py),))?
asyncio.call_method1("sleep", (1.into_pyobject(py).unwrap(),))?
)
})?;
Expand Down
3 changes: 2 additions & 1 deletion src/async_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ where
/// Python::with_gil(|py| {
/// pyo3_async_runtimes::async_std::into_future(
/// test_mod
/// .call_method1(py, "py_sleep", (seconds.into_py(py),))?
/// .call_method1(py, "py_sleep", (seconds.into_pyobject(py).unwrap(),))?
/// .into_bound(py),
/// )
/// })?
Expand All @@ -539,6 +539,7 @@ pub fn into_future(
/// ```
/// use pyo3::prelude::*;
/// use futures::{StreamExt, TryStreamExt};
/// use std::ffi::CString;
///
/// const TEST_MOD: &str = r#"
/// import asyncio
Expand Down
2 changes: 1 addition & 1 deletion src/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ fn set_result(
/// Python::with_gil(|py| {
/// pyo3_async_runtimes::generic::into_future::<MyCustomRuntime>(
/// test_mod
/// .call_method1(py, "py_sleep", (seconds.into_py(py),))?
/// .call_method1(py, "py_sleep", (seconds.into_pyobject(py).unwrap(),))?
/// .into_bound(py),
/// )
/// })?
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ fn call_soon_threadsafe<'py>(
///
/// ```
/// use std::time::Duration;
/// use std::ffi::CString;
///
/// use pyo3::prelude::*;
///
Expand Down Expand Up @@ -633,7 +634,7 @@ fn call_soon_threadsafe<'py>(
/// pyo3_async_runtimes::into_future_with_locals(
/// &pyo3_async_runtimes::tokio::get_current_locals(py)?,
/// test_mod
/// .call_method1(py, "py_sleep", (seconds.into_py(py),))?
/// .call_method1(py, "py_sleep", (seconds.into_pyobject(py).unwrap(),))?
/// .into_bound(py),
/// )
/// })?
Expand Down
2 changes: 1 addition & 1 deletion src/tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ where
/// Python::with_gil(|py| {
/// pyo3_async_runtimes::tokio::into_future(
/// test_mod
/// .call_method1(py, "py_sleep", (seconds.into_py(py),))?
/// .call_method1(py, "py_sleep", (seconds.into_pyobject(py).unwrap(),))?
/// .into_bound(py),
/// )
/// })?
Expand Down

0 comments on commit 9f0d899

Please sign in to comment.