Skip to content

release GIL for detached smol::Executor #30

@ertosns

Description

@ertosns

Discussed in PyO3/pyo3#4775

Originally posted by ertosns December 6, 2024
allow_threads doesn't release gil for detached smol::Executor in background, for example the following code block only run in the main thread, and the gil doesn't seem to be released.

async fn executor_run() {
    let ex = Arc::new(smol::Executor::new());
    let fut = ex.spawn(async {
        println!("executor run\n");
    });
    Python::with_gil(|gil| {
            gil.allow_threads(|| {
                fut.detach();
            })
    })
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions