diff --git a/tests/test_base.py b/tests/test_base.py index 89a82fe4..745e7cb7 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -938,6 +938,12 @@ def test_loop_call_later_handle_when_after_fired(self): self.loop.run_until_complete(fut) self.assertEqual(handle.when(), when) + def test_loop_call_later_0_returns_timer_handle(self): + cb = lambda: False # NoQA + handle = self.loop.call_later(0, cb) + handle.when() + handle.cancel() + class TestBaseAIO(_TestBase, AIOTestCase): pass diff --git a/uvloop/loop.pyx b/uvloop/loop.pyx index 2ed1f272..ea4e1d38 100644 --- a/uvloop/loop.pyx +++ b/uvloop/loop.pyx @@ -1326,10 +1326,7 @@ cdef class Loop: when = round(delay * 1000) if not args: args = None - if when == 0: - return self._call_soon(callback, args, context) - else: - return self._call_later(when, callback, args, context) + return self._call_later(when, callback, args, context) def call_at(self, when, callback, *args, context=None): """Like call_later(), but uses an absolute time.