[Pyrex] Avoiding unnecessary type checks for None
    Stefan Behnel 
    stefan_ml at behnel.de
       
    Tue Feb 13 22:35:11 UTC 2007
    
    
  
Hi,
here's a little patch that removes the obviously unnecessary extension type
checks for None values (PyTypeTestNode).
Have fun,
Stefan
Index: Pyrex/Compiler/ExprNodes.py
===================================================================
--- Pyrex/Compiler/ExprNodes.py (Revision 33613)
+++ Pyrex/Compiler/ExprNodes.py (Arbeitskopie)
@@ -2852,6 +2884,8 @@
         return self.arg.result_code
     def generate_result_code(self, code):
+        if isinstance(self.arg, NoneNode):
+            return
         if self.type.typeobj_is_available():
             code.putln(
                 "if (!__Pyx_TypeTest(%s, %s)) %s" % (
    
    
More information about the Pyrex
mailing list