From 3c0b5948f4321d100f3dd10c6da98551da173d5b Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Mon, 26 Apr 2010 06:51:23 +0200 Subject: [PATCH] keep 'constant_result' set when injecting new constant nodes --- Cython/Compiler/Optimize.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index 8a21f64c..93128563 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -2204,14 +2204,17 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform): def _inject_int_default_argument(self, node, args, arg_index, type, default_value): assert len(args) >= arg_index if len(args) == arg_index: - args.append(ExprNodes.IntNode(node.pos, value=str(default_value), type=type)) + args.append(ExprNodes.IntNode(node.pos, value=str(default_value), + type=type, constant_result=default_value)) else: args[arg_index] = args[arg_index].coerce_to(type, self.current_env()) def _inject_bint_default_argument(self, node, args, arg_index, default_value): assert len(args) >= arg_index if len(args) == arg_index: - args.append(ExprNodes.BoolNode(node.pos, value=bool(default_value))) + default_value = bool(default_value) + args.append(ExprNodes.BoolNode(node.pos, value=default_value, + constant_result=default_value)) else: args[arg_index] = args[arg_index].coerce_to_boolean(self.current_env()) -- 2.26.2