transforms/inline: strip docstrings

This commit is contained in:
Sebastien Bourdeauducq 2014-09-30 00:46:14 +08:00
parent d3e70ec53d
commit c95f5bdff3
1 changed files with 4 additions and 0 deletions

View File

@ -218,6 +218,10 @@ class _ReferenceReplacer(ast.NodeVisitor):
node)
def visit_Expr(self, node):
if isinstance(node.value, ast.Str):
# Strip docstrings. This also removes strings appearing in the
# middle of the code, but they are nops.
return None
self.generic_visit(node)
if isinstance(node.value, ast.Name):
# Remove Expr nodes that contain only a name, likely due to