logo       

Compiling without assertions: msg#00010

python.pyrex

Subject: Compiling without assertions

Hi,

this trivial patch allows compiling out all "assert" statements by defining
PYREX_WITHOUT_ASSERTIONS in the C compiler (through distutils, a header file,
compiler option or whatever).

Stefan


Index: Pyrex/Compiler/Nodes.py
===================================================================
--- Pyrex/Compiler/Nodes.py (Revision 136)
+++ Pyrex/Compiler/Nodes.py (Arbeitskopie)
@@ -2896,6 +2896,7 @@
#env.recycle_pending_temps() # TEMPORARY

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)
@@ -2916,6 +2917,7 @@
self.cond.generate_disposal_code(code)
if self.value:
self.value.generate_disposal_code(code)
+ code.putln("#endif")


class IfStatNode(StatNode):


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise