Eric Huss's readonly variable patch:
authorWilliam Stein <wstein@gmail.com>
Thu, 30 Nov 2006 19:57:57 +0000 (11:57 -0800)
committerWilliam Stein <wstein@gmail.com>
Thu, 30 Nov 2006 19:57:57 +0000 (11:57 -0800)
There's a minor bug, if you try to cdef a readonly variable at the module
scope, the compiler raises an UnboundLocalError exception.  The attached
patch seems to clear up the problem and gets the compiler to report the
correct error.

Cython/Compiler/Code.py

index 062efb6a0f420c6e359598a27801a06c78a7d44a..08f186cc8b22d320866c1390c7801a58a4299069 100644 (file)
@@ -183,6 +183,8 @@ class CCodeWriter:
                 storage_class = "static"
             else:
                 storage_class = ""
+       else:
+           storage_class = ""
         if storage_class:
             self.put("%s " % storage_class)
         #if visibility == 'extern' or visibility == 'public' and not definition: