Step towards fixing #252
authorRobert Bradshaw <robertwb@math.washington.edu>
Fri, 27 Mar 2009 11:26:32 +0000 (04:26 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Fri, 27 Mar 2009 11:26:32 +0000 (04:26 -0700)
Cython/Compiler/Nodes.py
Cython/Compiler/Symtab.py

index 0de02d9782ceaed75478376a7cf300128de535f4..ce6a1af0e89a4f98408ea7d12bfe9f383b879087 100644 (file)
@@ -550,8 +550,7 @@ class CFuncDeclaratorNode(CDeclaratorNode):
         if self.optional_arg_count:
             scope = StructOrUnionScope()
             arg_count_member = '%sn' % Naming.pyrex_prefix
-            scope.declare_var(arg_count_member, PyrexTypes.c_int_type, self.pos,
-                              cname = arg_count_member)
+            scope.declare_var(arg_count_member, PyrexTypes.c_int_type, self.pos)
             for arg in func_type_args[len(func_type_args)-self.optional_arg_count:]:
                 scope.declare_var(arg.name, arg.type, arg.pos, allow_pyobject = 1)
             struct_cname = env.mangle(Naming.opt_arg_prefix, self.base.name)
index 6636dd1b7fb84bdbc05b45f88a6462739ef25bc7..53e930579eaf76c1fc981a4553b717e8b604cf6d 100644 (file)
@@ -32,7 +32,7 @@ ansi_c_keywords = set(
 
 def c_safe_identifier(cname):
     # There are some C limitations on struct entry names. 
-    if cname[:2] == '__' or cname in ansi_c_keywords:
+    if (cname[:2] == '__' and not cname.startswith(Naming.pyrex_prefix)) or cname in ansi_c_keywords:
         cname = Naming.pyrex_prefix + cname
     return cname