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

Robert Bradshaw robertwb at math.washington.edu
Fri Apr 3 01:43:42 CEST 2009


On Apr 2, 2009, at 4:26 PM, Lisandro Dalcin wrote:

> 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

Oops, yes. Please push.

- Robert



More information about the Cython-dev mailing list