From acbc5e462ff11679734c9c993dc145e61d63d37e Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Tue, 4 Nov 2014 02:49:44 +0200 Subject: [PATCH] uasyncio.core: Implement EventLoop.create_task(), new method in Python 3.4.2. This method allows to schedule a coroutine in a loop without confusing globals like async() or Task(). --- uasyncio.core/uasyncio/core.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/uasyncio.core/uasyncio/core.py b/uasyncio.core/uasyncio/core.py index 1c5632e2..500c21d3 100644 --- a/uasyncio.core/uasyncio/core.py +++ b/uasyncio.core/uasyncio/core.py @@ -16,6 +16,11 @@ class EventLoop: def time(self): return time.time() + def create_task(self, coro): + # CPython 3.4.2 + self.call_at(0, callback) + # CPython asyncio incompatibility: we don't return Task object + def call_soon(self, callback, *args): self.call_at(0, callback, *args)