Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bindings/python/src/asyncio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl AsyncOperator {
})
.unwrap_or_default();

Ok(AsyncOperator(build_operator(scheme, map, layers)?))
Ok(AsyncOperator(build_operator(scheme, map, layers, false)?))
}

/// Read the whole path into bytes.
Expand Down
12 changes: 10 additions & 2 deletions bindings/python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,14 @@ fn build_operator(
scheme: od::Scheme,
map: HashMap<String, String>,
layers: Vec<layers::Layer>,
blocking: bool,
) -> PyResult<od::Operator> {
let op = od::Operator::via_map(scheme, map).map_err(format_pyerr)?;
let mut op = od::Operator::via_map(scheme, map).map_err(format_pyerr)?;
if blocking && !op.info().full_capability().blocking {
let runtime = pyo3_asyncio::tokio::get_runtime();
let _guard = runtime.enter();
op = op.layer(od::layers::BlockingLayer::create().expect("blocking layer must be created"));
Comment thread
messense marked this conversation as resolved.
}

add_layers(op, layers)
}
Expand Down Expand Up @@ -92,7 +98,9 @@ impl Operator {
})
.unwrap_or_default();

Ok(Operator(build_operator(scheme, map, layers)?.blocking()))
Ok(Operator(
build_operator(scheme, map, layers, true)?.blocking(),
))
}

/// Read the whole path into bytes.
Expand Down