Simon Anders, 26.08.2010 14:12:
> If I declare a variable of type 'list' without initializing it and then
> try to use it, I get an error that my object is actually None, which
> makes sense:
>
> def test1():
>      cdef list l
>      l.append( "A" )
>
> $ python -c 'import test; test.test1()'
> Traceback (most recent call last):
>     File "<string>", line 1, in<module>
>     File "test.pyx", line 3, in test.test1 (test.c:396)
>       l.append( "A" )
> AttributeError: 'NoneType' object has no attribute 'append'
>
>
> However, if I do the same with a set, an internal error is triggered:
>
> def test2():
>      cdef set s
>      s.add( "A" )
>
> $ python -c 'import test; test.test2()'
> Traceback (most recent call last):
>     File "<string>", line 1, in<module>
>     File "test.pyx", line 7, in test.test2 (test.c:434)
>       s.add( "A" )
> SystemError: Objects/setobject.c:2303: bad argument to internal function

Right, the latter is based on the "old" way of handling builtin type 
methods. It lacks None tests by design.

http://trac.cython.org/cython_trac/ticket/571

Thanks for the report.

Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to