let type analysis know that globals() and locals() can never return None
authorStefan Behnel <stefan_ml@behnel.de>
Fri, 15 Feb 2013 17:07:16 +0000 (18:07 +0100)
committerStefan Behnel <stefan_ml@behnel.de>
Fri, 15 Feb 2013 17:07:16 +0000 (18:07 +0100)
Cython/Compiler/ExprNodes.py

index e1f69d2..1a7b7b3 100755 (executable)
@@ -6242,6 +6242,9 @@ class SortedDictKeysNode(ExprNode):
         self.arg = arg
         return self
 
+    def may_be_none(self):
+        return False
+
     def generate_result_code(self, code):
         dict_result = self.arg.py_result()
         if self.arg.type is Builtin.dict_type:
@@ -7216,6 +7219,9 @@ class GlobalsExprNode(AtomicExprNode):
 
     gil_message = "Constructing globals dict"
 
+    def may_be_none(self):
+        return False
+
     def generate_result_code(self, code):
         code.putln('%s = __Pyx_Globals(); %s' % (
             self.result(),
@@ -7263,6 +7269,9 @@ class PyClassLocalsExprNode(AtomicExprNode):
         self.is_temp = False
         return self
 
+    def may_be_none(self):
+        return False
+
     def result(self):
         return self.pyclass_dict.result()