Commit 7176077c authored by Lisandro Dalcin's avatar Lisandro Dalcin

special-case __weakref__ when determining C-safe identifiers (related to #252)

parent 550bb60a
...@@ -32,8 +32,11 @@ iso_c99_keywords = set( ...@@ -32,8 +32,11 @@ iso_c99_keywords = set(
'_Bool', '_Complex'', _Imaginary', 'inline', 'restrict']) '_Bool', '_Complex'', _Imaginary', 'inline', 'restrict'])
def c_safe_identifier(cname): def c_safe_identifier(cname):
# There are some C limitations on struct entry names. # 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: if ((cname[:2] == '__'
and not (cname.startswith(Naming.pyrex_prefix)
or cname == '__weakref__'))
or cname in iso_c99_keywords):
cname = Naming.pyrex_prefix + cname cname = Naming.pyrex_prefix + cname
return cname return cname
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment