PythonCharmers/python-future

raise_from don't work

Open

#323 创建于 2018年1月23日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)Python (1,172 star) (327 fork)batch import
0.20bugexceptionshelp wanted

描述

python version: 2.7.14 future version: 0.16.0

from future.utils import raise_from

def fa():
    try:
        b()
    except Exception as ex:
        raise_from(Exception('fa'), ex)

def b():
    raise Exception('b')

if __name__ == "__main__":
    fa()

output:

Traceback (most recent call last):
  File ".\mod.py", line 20, in <module>
    fa()
  File ".\mod.py", line 8, in fa
    raise_from(Exception('fa'), ex)
  File "C:\Python27\lib\site-packages\future\utils\__init__.py", line 454, in raise_from
    raise e
Exception: fa

贡献者指南