in hfendpoints-http/src/lib.rs [266:284]
fn run(endpoint: PyObject, interface: String, port: u16) -> PyResult<()> {
prepare_freethreaded_python();
// Initialize the tokio runtime and bind this runtime to the tokio <> asyncio compatible layer
init(create_multithreaded_runtime());
Python::with_gil(|py| {
py.allow_threads(|| {
pyo3_async_runtimes::tokio::get_runtime().block_on(async {
Python::with_gil(|inner| {
pyo3_async_runtimes::tokio::run(inner, serve(endpoint, interface, port))
})?;
Ok::<_, PyErr>(())
})
})
})?;
Ok::<_, PyErr>(())
}