Skip to content
Open
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
6 changes: 6 additions & 0 deletions tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions uvloop/loop.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1326,10 +1326,7 @@ cdef class Loop:
when = <uint64_t>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.
Expand Down
Loading