From: Lisandro Dalcin Date: Fri, 3 Apr 2009 00:23:19 +0000 (-0300) Subject: special-case __weakref__ when determining C-safe identifiers (related to #252) X-Git-Tag: 0.11.1.alpha~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7176077cd60478379ac418ccae17ff95fd4e92e3;p=cython.git special-case __weakref__ when determining C-safe identifiers (related to #252) --- diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 885c9ad1..fdcbe2bb 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -32,8 +32,11 @@ iso_c99_keywords = set( '_Bool', '_Complex'', _Imaginary', 'inline', 'restrict']) def c_safe_identifier(cname): - # There are some C limitations on struct entry names. - if (cname[:2] == '__' and not cname.startswith(Naming.pyrex_prefix)) or cname in iso_c99_keywords: + # There are some C limitations on struct entry names. + if ((cname[:2] == '__' + and not (cname.startswith(Naming.pyrex_prefix) + or cname == '__weakref__')) + or cname in iso_c99_keywords): cname = Naming.pyrex_prefix + cname return cname