Skip to content
Open
Changes from 1 commit
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
Prev Previous commit
Update src/coroutine/awaitable.rs
Co-authored-by: David Hewitt <[email protected]>
  • Loading branch information
wyfo and davidhewitt authored Apr 15, 2025
commit 5c8346e72ffe13ca493cf71ffc7ee5ca52c0d9cd
3 changes: 1 addition & 2 deletions src/coroutine/awaitable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ const NOT_IN_COROUTINE_CONTEXT: &str = "Python awaitable must be awaited in coro

fn is_awaitable(obj: &Bound<'_, PyAny>) -> PyResult<bool> {
static IS_AWAITABLE: GILOnceCell<PyObject> = GILOnceCell::new();
let import = || PyResult::Ok(obj.py().import("inspect")?.getattr("isawaitable")?.into());
IS_AWAITABLE
.get_or_try_init(obj.py(), import)?
.import(ob.py(), "inspect", "isawaitable")?
.call1(obj.py(), (obj,))?
.extract(obj.py())
}
Expand Down