Skip to content

Commit 3876cc6

Browse files
author
Andrew J Westlake
committed
Updated examples in the guide to take advantage of cleaner returns
1 parent e90eeef commit 3876cc6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ use pyo3::{prelude::*, wrap_pyfunction};
142142
fn rust_sleep(py: Python) -> PyResult<&PyAny> {
143143
pyo3_asyncio::async_std::future_into_py(py, async {
144144
async_std::task::sleep(std::time::Duration::from_secs(1)).await;
145-
Ok(Python::with_gil(|py| py.None()))
145+
Ok(())
146146
})
147147
}
148148

@@ -166,7 +166,7 @@ use pyo3::{prelude::*, wrap_pyfunction};
166166
fn rust_sleep(py: Python) -> PyResult<&PyAny> {
167167
pyo3_asyncio::tokio::future_into_py(py, async {
168168
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
169-
Ok(Python::with_gil(|py| py.None()))
169+
Ok(())
170170
})
171171
}
172172

@@ -283,7 +283,7 @@ async fn rust_sleep() {
283283
fn call_rust_sleep(py: Python) -> PyResult<&PyAny> {
284284
pyo3_asyncio::async_std::future_into_py(py, async move {
285285
rust_sleep().await;
286-
Ok(Python::with_gil(|py| py.None()))
286+
Ok(())
287287
})
288288
}
289289
```
@@ -433,7 +433,7 @@ use pyo3::{prelude::*, wrap_pyfunction};
433433
fn rust_sleep(py: Python) -> PyResult<&PyAny> {
434434
pyo3_asyncio::tokio::future_into_py(py, async {
435435
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
436-
Ok(Python::with_gil(|py| py.None()))
436+
Ok(())
437437
})
438438
}
439439

0 commit comments

Comments
 (0)