PythonCharmers/python-future

raise_from don't work

Open

#323 opened on Jan 23, 2018

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Python (1,172 stars) (327 forks)batch import
0.20bugexceptionshelp wanted

Description

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

Contributor guide