Skip to content

Commit 9c60360

Browse files
author
Andrew J Westlake
committed
Changed call_soon_threadsafe to pass 'context' as a kwarg only when context is not None
1 parent 268de73 commit 9c60360

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,12 @@ fn call_soon_threadsafe(
710710
let py = event_loop.py();
711711

712712
let kwargs = PyDict::new(py);
713-
kwargs.set_item("context", context)?;
713+
714+
// Accommodate for the Python 3.6 fallback
715+
// (call_soon_threadsafe does not support the context kwarg in 3.6)
716+
if !context.is_none() {
717+
kwargs.set_item("context", context)?;
718+
}
714719

715720
event_loop.call_method("call_soon_threadsafe", args, Some(kwargs))?;
716721
Ok(())

0 commit comments

Comments
 (0)