Skip to content

The FixRaise in fix_raise can't fix the py2 code into 2/3 compatible when exception followed by a traceback. #643

@bulbyang

Description

@bulbyang

The py2 code is here

import sys

traceback = sys.exc_info()[2]

raise ValueError, "wrong value", traceback

The code generated by futurize is here

import sys

traceback = sys.exc_info()[2]

raise ValueError("wrong value").with_traceback(traceback)

The second one is only legal on python3.
I think that it is reasonable to fix the exception with traceback by use the function future.utils.raise_()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions