From 9f0d899d529e30b40af867454873a7138b95b0eb Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Tue, 19 Nov 2024 23:46:46 +0000 Subject: [PATCH] fixes --- README.md | 6 +++--- src/async_std.rs | 3 ++- src/generic.rs | 2 +- src/lib.rs | 3 ++- src/tokio.rs | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f987308..b98403a 100644 --- a/README.md +++ b/README.md @@ -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?; @@ -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?; @@ -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(),))? ) })?; diff --git a/src/async_std.rs b/src/async_std.rs index ea99e9a..34c9401 100644 --- a/src/async_std.rs +++ b/src/async_std.rs @@ -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), /// ) /// })? @@ -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 diff --git a/src/generic.rs b/src/generic.rs index 753c03d..3f96f08 100644 --- a/src/generic.rs +++ b/src/generic.rs @@ -457,7 +457,7 @@ fn set_result( /// Python::with_gil(|py| { /// pyo3_async_runtimes::generic::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), /// ) /// })? diff --git a/src/lib.rs b/src/lib.rs index e56f6b4..480e8a4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -605,6 +605,7 @@ fn call_soon_threadsafe<'py>( /// /// ``` /// use std::time::Duration; +/// use std::ffi::CString; /// /// use pyo3::prelude::*; /// @@ -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), /// ) /// })? diff --git a/src/tokio.rs b/src/tokio.rs index 724beb4..47e6da0 100644 --- a/src/tokio.rs +++ b/src/tokio.rs @@ -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), /// ) /// })?