Permalink
Browse files

Don't forget about a Timer when it is set with a Timeout...

  • Loading branch information...
1 parent d8bfd55 commit 604dc1c6b4f2837e92c1c55e9979a5c7ae62cf19 Alvaro committed Nov 19, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 evy/timeout.py
View
@@ -71,10 +71,13 @@ def start (self):
else:
hub = get_hub()
if self.exception is None or isinstance(self.exception, bool): # timeout that raises self
- self.timer = hub.schedule_call_global(self.seconds, greenlet.getcurrent().throw, self)
+ exc = self
else: # regular timeout with user-provided exception
- self.timer = hub.schedule_call_global(self.seconds, greenlet.getcurrent().throw, self.exception)
- self.timer.forget()
+ exc = self.exception
+
+ self.timer = hub.schedule_call_global(self.seconds, greenlet.getcurrent().throw, exc)
+
+ ## TODO: breaks some tests, but maybe we should call self.timer.forget()...
return self

0 comments on commit 604dc1c

Please sign in to comment.