future.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:rice 作者: randy3k 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号