From 738ce40442da06b38571ff131e5996297a428e62 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 29 Aug 2013 21:54:17 +0200 Subject: [PATCH] disable 'assert' when Python runtime runs with -O/-OO --- Cython/Compiler/Nodes.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 852d628..fe7adb3 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -5183,6 +5183,7 @@ class AssertStatNode(StatNode): def generate_execution_code(self, code): code.putln("#ifndef CYTHON_WITHOUT_ASSERTIONS") + code.putln("if (unlikely(!Py_OptimizeFlag)) {") self.cond.generate_evaluation_code(code) code.putln( "if (unlikely(!%s)) {" % @@ -5203,6 +5204,8 @@ class AssertStatNode(StatNode): "}") self.cond.generate_disposal_code(code) self.cond.free_temps(code) + code.putln( + "}") code.putln("#endif") def generate_function_definitions(self, env, code): -- 2.7.4