Commit 8a141881 authored by Robert Bradshaw's avatar Robert Bradshaw

Move assert exception object creation inside assert if block

parent 483a99c3
......@@ -2174,15 +2174,15 @@ class AssertStatNode(StatNode):
def generate_execution_code(self, code):
code.putln("#ifndef PYREX_WITHOUT_ASSERTIONS")
self.cond.generate_evaluation_code(code)
if self.value:
self.value.generate_evaluation_code(code)
code.putln(
"if (unlikely(!%s)) {" %
self.cond.result_code)
if self.value:
self.value.generate_evaluation_code(code)
code.putln(
"PyErr_SetObject(PyExc_AssertionError, %s);" %
self.value.py_result())
self.value.generate_disposal_code(code)
else:
code.putln(
"PyErr_SetNone(PyExc_AssertionError);")
......@@ -2191,8 +2191,6 @@ class AssertStatNode(StatNode):
code.putln(
"}")
self.cond.generate_disposal_code(code)
if self.value:
self.value.generate_disposal_code(code)
code.putln("#endif")
class IfStatNode(StatNode):
......
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