Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libfuturize/fixes/fix_raise.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def transform(self, node, results):
args = [exc, Comma(), val]
if tb is not None:
args += [Comma(), tb]
return Call(Name(u"raise_"), args)
return Call(Name(u"raise_"), args, prefix=node.prefix)

if tb is not None:
tb.prefix = ""
Expand Down
14 changes: 14 additions & 0 deletions tests/test_future/test_libfuturize_fixers.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,20 @@ def test_unknown_value_with_traceback_with_comments(self):
raise_(E, Func(arg1, arg2, arg3), tb) # foo"""
self.check(b, a)

def test_unknown_value_with_indent(self):
b = """
while True:
print() # another expression in the same block triggers different parsing
raise E, V
"""
a = """
from future.utils import raise_
while True:
print() # another expression in the same block triggers different parsing
raise_(E, V)
"""
self.check(b, a)

# These should produce a warning

def test_string_exc(self):
Expand Down