Closed GoogleCodeExporter closed 9 years ago
whoops, a minor fix to the patch:
in Future.__repr__, it should use "self._exc_info[0].__name__" instead of
"self._exc_info[0]"
also, you might want to implement a Future.exc_info() that does exactly the same
thing as Future.exception() but returns the whole of self._exc_info instead of
just
self._exc_info[1].
Original comment by infinity0x@gmail.com
on 3 Apr 2010 at 6:34
The problem with this approach is that changes the exception type.
Original comment by brian.qu...@gmail.com
on 30 Apr 2010 at 4:27
This issue is solved in Python 3.x. Since that is what my PEP is targeting,
maybe that is OK.
Original comment by brian.qu...@gmail.com
on 30 Apr 2010 at 4:37
if by "change the exception type" you mean it's now wrapped in another
exception, why
is this a problem? it's what java does, and this library claims to be
java-style?
Original comment by infinity0x@gmail.com
on 12 May 2010 at 5:26
Java has to do it because exceptions are checked - Python doesn't have that
problem. Changing the
exception type is annoying because it converts code that looks like this:
try:
future.result()
except ValueError:
...
except IOError:
...
to:
try:
future.result()
except futures.ExecutionException as e:
if e.exc_info()[0] == ValueError:
...
elif e.exc_info()[0] == IOError:
...
Original comment by Dublin...@gmail.com
on 21 May 2010 at 1:18
or just
try:
future.result()
except ExecutionException as e:
try:
raise e.exc_info()
catch ValueError:
...
catch IOError:
...
in which case the stack trace is preserved. your current way will destroy the
stack
trace from when the exception was thrown in the other thread.
Original comment by infinity0x@gmail.com
on 21 May 2010 at 8:52
Original comment by brian.qu...@gmail.com
on 14 Nov 2010 at 3:49
Original issue reported on code.google.com by
infinity0x@gmail.com
on 3 Apr 2010 at 6:29Attachments: