luensdorf  committed 1d16df8

Use types to check for correct until values.

  • Participants
  • Parent commits 96984ed

Comments (0)

Files changed (1)

File simpy/

 from heapq import heappush, heappop
 from inspect import isgenerator
 from itertools import count
+from numbers import Number
 # BaseEvent types/priorities
     if until is None:
         until = env.event()
-    elif not hasattr(until, 'callbacks'):
+    elif isinstance(until, Number):
         until = env.timeout(until -
+    elif not isinstance(until, Event):
+        raise ValueError('"until" must be None, a number or an event but '
+                'not "%s"' % until)
     events = env._events
     while events and until.callbacks is not None: