From 55ca7b76d5412865b4c9f26cadfe20196d6a5ca9 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Mon, 12 Jan 2009 20:20:50 +0600 Subject: [PATCH] more informative messages for LinkedExited errors; especially useful when function is a bound method --- eventlet/proc.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/eventlet/proc.py b/eventlet/proc.py index 52f5420..c012a16 100644 --- a/eventlet/proc.py +++ b/eventlet/proc.py @@ -53,7 +53,7 @@ case the notification is performed immediatelly: >>> api.sleep(0) Traceback (most recent call last): ... -LinkedCompleted: linked proc 'demofunc' completed successfully +LinkedCompleted: linked proc '' completed successfully (Without an argument, link is created to the current greenlet) @@ -68,7 +68,7 @@ fails then there's no way to complete the task so the parent must fail as well; >>> api.sleep(0.01) Traceback (most recent call last): ... -LinkedFailed: linked proc 'demofunc' failed with ZeroDivisionError +LinkedFailed: linked proc '' failed with ZeroDivisionError One application of linking is `wait' function: link to a bunch of coroutines and wait for all them to complete. Such function is provided by this module. @@ -407,9 +407,7 @@ class Proc(Source): """ assert self.greenlet is None, "'run' can only be called once per instance" if self.name is None: - self.name = getattr(function, '__name__', None) - if self.name is None: - self.name = getattr(type(function), '__name__', '') + self.name = str(function) self.greenlet = spawn_greenlet(self._run, function, args, kwargs) def _run(self, function, args, kwargs):