Vitja Makarov, 08.03.2011 20:12:
What is the right way to handle cdefed unbounds?

cdef object foo
print foo

cdef int foo
print foo

Fail with a compile error.


And how buffers and arrays should be handled? Now I'm skipping
buffers, arrays and structs.


There are some examples in test suite:

------------------------------------------------------------
...
cdef void spam():
     cdef long long L
     cdef unsigned long long U
     cdef object x
     L = x
         ^
------------------------------------------------------------

ass2longlong.pyx:5:9: local variable 'x' referenced before assignment

cdef void spam():
     cdef object x
     del x[17:42]
         ^
------------------------------------------------------------

delslice.pyx:3:9: local variable 'x' referenced before assignment

cdef void tomato():
     cdef Spam spam
     cdef SuperSpam superspam
     spam = superspam
                    ^
------------------------------------------------------------

extcmethcall.pyx:16:20: local variable 'superspam' referenced before assignment

def f(Grail g):
     cdef int i = 0
     cdef Swallow s
     cdef object x
     g = x
         ^
------------------------------------------------------------

extcoerce.pyx:13:9: local variable 'x' referenced before assignment


Should this raise error message or not?

Absolutely. The examples above are most likely left-overs from Pyrex' test suite, which wasn't meant to run the code that it generated.

Stefan
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to