From 7176077cd60478379ac418ccae17ff95fd4e92e3 Mon Sep 17 00:00:00 2001 From: Lisandro Dalcin Date: Thu, 2 Apr 2009 21:23:19 -0300 Subject: [PATCH] special-case __weakref__ when determining C-safe identifiers (related to #252) --- Cython/Compiler/Symtab.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 -- 2.26.2