From fb5e8683b0ff9325c4cbdaca055059801b0ef5ac Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 8 Dec 2013 11:15:59 +0100 Subject: [PATCH] discard ExprStatNodes with constant expressions --- Cython/Compiler/Optimize.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index 27a10d9..d1a53d6 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -3402,6 +3402,13 @@ class ConstantFolding(Visitor.VisitorTransform, SkipDeclarations): return node return None + def visit_ExprStatNode(self, node): + self.visitchildren(node) + # drop unused constant expressions + if node.expr.has_constant_result(): + return None + return node + # in the future, other nodes can have their own handler method here # that can replace them with a constant result node -- 2.7.4