[Cython] PATCH: related to ticket #252, special case __weakref__

Lisandro Dalcin dalcinl at gmail.com
Fri Apr 3 01:26:20 CEST 2009


Robert, likely you forgot about this detail releated weakrefs. Perhaps
the special-case should be done elsewhere?

diff -r 5cabe56c76ab Cython/Compiler/Symtab.py
--- a/Cython/Compiler/Symtab.py	Wed Mar 25 14:23:29 2009 -0700
+++ b/Cython/Compiler/Symtab.py	Thu Apr 02 20:23:49 2009 -0300
@@ -32,7 +32,10 @@

 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 ansi_c_keywords:
+    if ((cname[:2] == '__'
+         and not (cname.startswith(Naming.pyrex_prefix)
+                  or cname == '__weakref__'))
+        or  cname in ansi_c_keywords):
         cname = Naming.pyrex_prefix + cname
     return cname


-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594


More information about the Cython-dev mailing list