Commit 738ce404 authored by Stefan Behnel's avatar Stefan Behnel

disable 'assert' when Python runtime runs with -O/-OO

parent c5ec32f6
...@@ -5183,6 +5183,7 @@ class AssertStatNode(StatNode): ...@@ -5183,6 +5183,7 @@ class AssertStatNode(StatNode):
def generate_execution_code(self, code): def generate_execution_code(self, code):
code.putln("#ifndef CYTHON_WITHOUT_ASSERTIONS") code.putln("#ifndef CYTHON_WITHOUT_ASSERTIONS")
code.putln("if (unlikely(!Py_OptimizeFlag)) {")
self.cond.generate_evaluation_code(code) self.cond.generate_evaluation_code(code)
code.putln( code.putln(
"if (unlikely(!%s)) {" % "if (unlikely(!%s)) {" %
...@@ -5203,6 +5204,8 @@ class AssertStatNode(StatNode): ...@@ -5203,6 +5204,8 @@ class AssertStatNode(StatNode):
"}") "}")
self.cond.generate_disposal_code(code) self.cond.generate_disposal_code(code)
self.cond.free_temps(code) self.cond.free_temps(code)
code.putln(
"}")
code.putln("#endif") code.putln("#endif")
def generate_function_definitions(self, env, code): def generate_function_definitions(self, env, code):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment