Skip to content

Commit d800b90

Browse files
author
Andrew J Westlake
committed
Bumped pyo3 version to 0.14, fixed misc problems due to the auto-initialize feature being disabled in 0.14
1 parent c61ef22 commit d800b90

14 files changed

+32
-5
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "pyo3-asyncio"
33
description = "PyO3 utilities for Python's Asyncio library"
4-
version = "0.13.4"
4+
version = "0.14.0"
55
authors = ["Andrew J Westlake <[email protected]>"]
66
readme = "README.md"
77
keywords = ["pyo3", "python", "ffi", "async", "asyncio"]
@@ -89,8 +89,8 @@ futures = "0.3"
8989
inventory = "0.1"
9090
lazy_static = "1.4"
9191
once_cell = "1.5"
92-
pyo3 = "0.13"
93-
pyo3-asyncio-macros = { path = "pyo3-asyncio-macros", version = "=0.13.4", optional = true }
92+
pyo3 = "0.14"
93+
pyo3-asyncio-macros = { path = "pyo3-asyncio-macros", version = "=0.14.0", optional = true }
9494

9595
[dependencies.async-std]
9696
version = "1.9"

pyo3-asyncio-macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "pyo3-asyncio-macros"
33
description = "Proc Macro Attributes for PyO3 Asyncio"
4-
version = "0.13.4"
4+
version = "0.14.0"
55
authors = ["Andrew J Westlake <[email protected]>"]
66
readme = "../README.md"
77
keywords = ["pyo3", "python", "ffi", "async", "asyncio"]

pyo3-asyncio-macros/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ pub fn async_std_main(_attr: TokenStream, item: TokenStream) -> TokenStream {
4949
#body
5050
}
5151

52+
pyo3::prepare_freethreaded_python();
53+
5254
pyo3::Python::with_gil(|py| {
5355
pyo3_asyncio::async_std::run(py, main())
5456
.map_err(|e| {

pyo3-asyncio-macros/src/tokio.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ fn parse_knobs(
247247
#body
248248
}
249249

250+
pyo3::prepare_freethreaded_python();
251+
250252
pyo3_asyncio::tokio::init(
251253
#rt
252254
.enable_all()

pytests/test_async_std_asyncio.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ async fn test_local_future_into_py() -> PyResult<()> {
159159

160160
#[allow(deprecated)]
161161
fn main() -> pyo3::PyResult<()> {
162+
pyo3::prepare_freethreaded_python();
163+
162164
Python::with_gil(|py| {
163165
// into_coroutine requires the 0.13 API
164166
pyo3_asyncio::try_init(py)?;

pytests/test_async_std_run_forever.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ fn dump_err(py: Python, e: PyErr) {
99
}
1010

1111
fn main() {
12+
pyo3::prepare_freethreaded_python();
13+
1214
Python::with_gil(|py| {
1315
let asyncio = py.import("asyncio")?;
1416

pytests/test_tokio_current_thread_asyncio.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use pyo3::prelude::*;
55

66
#[allow(deprecated)]
77
fn main() -> pyo3::PyResult<()> {
8+
pyo3::prepare_freethreaded_python();
9+
810
Python::with_gil(|py| {
911
// into_coroutine requires the 0.13 API
1012
pyo3_asyncio::try_init(py)?;

pytests/test_tokio_current_thread_run_forever.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
mod tokio_run_forever;
22

33
fn main() {
4+
pyo3::prepare_freethreaded_python();
45
pyo3_asyncio::tokio::init_current_thread();
56

67
tokio_run_forever::test_main();

pytests/test_tokio_multi_thread_asyncio.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use pyo3::prelude::*;
55

66
#[allow(deprecated)]
77
fn main() -> pyo3::PyResult<()> {
8+
pyo3::prepare_freethreaded_python();
9+
810
Python::with_gil(|py| {
911
// into_coroutine requires the 0.13 API
1012
pyo3_asyncio::try_init(py)?;

pytests/test_tokio_multi_thread_run_forever.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
mod tokio_run_forever;
22

33
fn main() {
4+
pyo3::prepare_freethreaded_python();
5+
46
pyo3_asyncio::tokio::init_multi_thread();
57

68
tokio_run_forever::test_main();

0 commit comments

Comments
 (0)