agronholm / pythonfutures

Backport of the concurrent.futures package to Python 2.6 and 2.7
Other
232 stars 51 forks source link

Preserve exception info when re-raising #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently the code does stuff like:

        except Exception, e:
            ...
            raise e # should just be 'raise'

and:

    def __get_result(self):
        if self._exception:
            raise self._exception
            # better to store complete exc_info & use 3-parameter raise
            # a,b,c = self._exc_info; raise a,b,c
        else:
            return self._result

As such, re-raised exceptions lose a great deal of information because the 
tracebacks are missing. The suggested fixes are also in line with your 
philosophy discussed in #2, in that you want to preserve the original exception.

Original issue reported on code.google.com by yanghate...@gmail.com on 10 Nov 2010 at 4:00

GoogleCodeExporter commented 9 years ago
Attached a small patch for this.

Original comment by yanghate...@gmail.com on 10 Nov 2010 at 5:15

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry this code path doesn't exist anymore

Original comment by brian.qu...@gmail.com on 14 Nov 2010 at 3:50

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks for taking a look. The diff was actually against svn HEAD of the time, 
and the path seems to still exist even in the current HEAD (r86...see, e.g., 
_base.py:322). Any hope of seeing this change make it into the library? Just 
hoping to help improve its usability. Thanks.

Original comment by yanghate...@gmail.com on 14 Nov 2010 at 6:52

GoogleCodeExporter commented 9 years ago
*Bump.* Please consider re-opening this ticket, or let me know what you mean 
when you say "this code path doesn't exist anymore" / point me to the current 
code. Thanks.

Original comment by yanghate...@gmail.com on 30 Jan 2011 at 5:54