fixed end marker in control flow engine
authorStefan Behnel <scoder@users.berlios.de>
Wed, 23 Apr 2008 04:28:02 +0000 (06:28 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 23 Apr 2008 04:28:02 +0000 (06:28 +0200)
Cython/Compiler/ControlFlow.py

index 16fc65d6ca21a89ead59f97fa20a0ba18316b9f9..e433f7d0ce5f49810d3d27425633a2b6dbaa1776 100644 (file)
@@ -1,4 +1,4 @@
-import bisect
+import bisect, sys
 
 # This module keeps track of arbitrary "states" at any point of the code. 
 # A state is considered known if every path to the given point agrees on
@@ -13,6 +13,8 @@ import bisect
 # redesigned. It doesn't take return, raise, continue, or break into 
 # account. 
 
+_END_POS = ((unichr(sys.maxunicode)*10),())
+
 class ControlFlow:
 
     def __init__(self, start_pos, incoming, parent):
@@ -22,7 +24,7 @@ class ControlFlow:
             parent = incoming.parent
         self.parent = parent
         self.tip = {}
-        self.end_pos = ((),)
+        self.end_pos = _END_POS
         
     def start_branch(self, pos):
         self.end_pos = pos
@@ -40,10 +42,10 @@ class ControlFlow:
         self.parent.end_pos = pos
         return LinearControlFlow(pos, self.parent)
         
-    def get_state(self, item, pos=((),())):
+    def get_state(self, item, pos=_END_POS):
         return self.get_pos_state(item, pos)[1]
         
-    def get_pos_state(self, item, pos=((),())):
+    def get_pos_state(self, item, pos=_END_POS):
         # do some caching
         if pos > self.end_pos:
             try: