From c95f5bdff37a7d92c7233b2911ff5e33fcc5e32d Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 30 Sep 2014 00:46:14 +0800 Subject: [PATCH] transforms/inline: strip docstrings --- artiq/transforms/inline.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/artiq/transforms/inline.py b/artiq/transforms/inline.py index dfb963bda..ef672c346 100644 --- a/artiq/transforms/inline.py +++ b/artiq/transforms/inline.py @@ -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