typing fixes in compiled Code.py
authorStefan Behnel <scoder@users.berlios.de>
Thu, 9 Dec 2010 09:22:49 +0000 (10:22 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 9 Dec 2010 09:22:49 +0000 (10:22 +0100)
Cython/Compiler/Code.pxd
Cython/Compiler/Code.py

index 67bf72fa35a75f3f00c0d76fce4e9e2e0c5e4bb3..87de03a87a9bc9a04ab2579839d59260d7065b2a 100644 (file)
@@ -1,4 +1,6 @@
 
+cimport cython
+
 cdef class UtilityCode:
     cdef public object proto
     cdef public object impl
@@ -9,14 +11,14 @@ cdef class UtilityCode:
     cdef public list specialize_list
     cdef public object proto_block
 
-    cpdef put_code(self, dict output)
+    cpdef put_code(self, output)
 
 cdef class FunctionState:
     cdef public set names_taken
     cdef public object owner
 
     cdef public object error_label
-    cdef public Py_ssize_t label_counter
+    cdef public size_t label_counter
     cdef public set labels_used
     cdef public object return_label
     cdef public object continue_label
@@ -30,8 +32,10 @@ cdef class FunctionState:
     cdef public list temps_allocated
     cdef public dict temps_free
     cdef public dict temps_used_type
-    cdef public Py_ssize_t temp_counter
+    cdef public size_t temp_counter
 
+    @cython.locals(n=size_t)
+    cpdef new_label(self, name=*)
     cpdef tuple get_loop_labels(self)
     cpdef set_loop_labels(self, labels)
     cpdef tuple get_all_labels(self)
@@ -54,6 +58,9 @@ cdef class StringConst:
     cdef public object escaped_value
     cdef public dict py_strings
 
+    @cython.locals(intern=bint, is_str=bint, is_unicode=bint)
+    cpdef get_py_string_const(self, encoding, identifier=*, is_str=*)
+
 ## cdef class PyStringConst:
 ##     cdef public object cname
 ##     cdef public object encoding
index fe46430d13eb885f17128aee0e25d684a1b28d80..6ebe5b19600cc7574f7d300b60bf82e9e9159a3b 100644 (file)
@@ -293,6 +293,8 @@ class PyObjectConst(object):
         self.cname = cname
         self.type = type
 
+cython.declare(possible_unicode_identifier=object, possible_bytes_identifier=object,
+               nice_identifier=object, find_alphanums=object)
 possible_unicode_identifier = re.compile(ur"(?![0-9])\w+$", re.U).match
 possible_bytes_identifier = re.compile(r"(?![0-9])\w+$".encode('ASCII')).match
 nice_identifier = re.compile(r'\A[a-zA-Z0-9_]+\Z').match