We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dd8f612 commit ad83b72Copy full SHA for ad83b72
unpythonic/syntax/util.py
@@ -444,7 +444,11 @@ def rec(tree):
444
handler.body = rec(handler.body)
445
elif type(tree) is list: # multiple-statement body in AST
446
return [output_stmt for input_stmt in tree for output_stmt in rec(input_stmt)]
447
- return f(tree) # a single statement
+ # A single statement. Transform it.
448
+ replacement = f(tree)
449
+ if not isinstance(replacement, list):
450
+ raise TypeError("`f` must return a list of statements, got {} with value '{}'".format(type(replacement), replacement)) # pragma: no cover
451
+ return replacement
452
return rec(body)
453
454
def splice(tree, rep, tag):
0 commit comments