Fix builtins caching
authorRobert Bradshaw <robertwb@math.washington.edu>
Wed, 24 Oct 2007 08:41:16 +0000 (01:41 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Wed, 24 Oct 2007 08:41:16 +0000 (01:41 -0700)
Cython/Compiler/ExprNodes.py
Cython/Compiler/ModuleNode.py
Cython/Compiler/Options.py

index 066cc61b35b4e7d91d9c5f3e398a040c0a0e2b54..cd9b71ffb9ef56dc71d01c5cc8c37fc164525c48 100644 (file)
@@ -815,7 +815,7 @@ class NameNode(AtomicExprNode):
         if entry.is_pyglobal or entry.is_builtin:
             assert type.is_pyobject, "Python global or builtin not a Python object"
             if Options.intern_names:
-                self.interned_cname = env.intern(self.entry.name)
+                self.interned_cname = self.entry.interned_cname = env.intern(self.entry.name)
 
     def check_identifier_kind(self):
         #print "NameNode.check_identifier_kind:", self.entry.name ###
index 28aad9a2d7b9deb5cc6e7826448e7353653dc03e..f27e37bae460b8672407f8d8293ce5669ba4b881 100644 (file)
@@ -1239,9 +1239,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
         code.putln("/*--- String init code ---*/")
         self.generate_string_init_code(env, code)
 
-        code.putln("/*--- Builtin init code ---*/")
-        # TODO: FIXME !!
-        #self.generate_builtin_init_code(env, code)
+        if Options.cache_builtins:
+            code.putln("/*--- Builtin init code ---*/")
+            self.generate_builtin_init_code(env, code)
 
         code.putln("/*--- Global init code ---*/")
         self.generate_global_init_code(env, code)
index ccb5f2165e91ff9141ce910e453176ff6b97990b..3b426f24ee1fb2755899cc30f593b7f8f4e4f06d 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 intern_names = 1    #  Intern global variable and attribute names
-cache_builtins = 0  #  Perform lookups on builtin names only once
+cache_builtins = 1  #  Perform lookups on builtin names only once
 
 embed_pos_in_docstring = 0
 gcc_branch_hints = 1