def set_exception(self, exception):
" Mark the future done and set an exception. "
if self._done:
raise InvalidStateError('Future result has been set already.')
self._exception = exception
self._done = True
if self.done_callbacks:
self._call_callbacks()
else:
# When an exception is set on a 'Future' object, but there
# is no callback set to handle it, print the exception.
# -- Uncomment for debugging. --
# import traceback, sys
# print(''.join(traceback.format_stack()), file=sys.__stderr__)
# print('Uncollected error: %r' % (exception, ), file=sys.__stderr__)
pass
评论列表
文章目录