From 2826c4248ca8ea1b837f087d00badc1ddb151f3c Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Fri, 27 Mar 2009 04:26:32 -0700 Subject: [PATCH] Step towards fixing #252 --- Cython/Compiler/Nodes.py | 3 +-- Cython/Compiler/Symtab.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 0de02d97..ce6a1af0 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -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) diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 6636dd1b..53e93057 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -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 -- 2.26.2