[Cython] A bug when declare array.

2013-08-19 Thread yi huang
I use cython 0.19.1, when compile following code:

cdef void some_function():
cdef char buf[sizeof(long)*8/3+6]

Got error message:

Error compiling Cython file:

...
cdef void some_function():
cdef char buf[sizeof(long)*8/3+6]
^


/tmp/test.pyx:2:17: Variable type 'char []' is incomplete
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] A bug when declare array.

2013-08-27 Thread yi huang
I just chooses a large enough buffer size, there is not much to waste anyway.

On Tue, Aug 27, 2013 at 3:43 PM, Sturla Molden  wrote:
>
>
>
> Den 22. aug. 2013 kl. 06:01 skrev Robert Bradshaw :
>
>> On Sat, Aug 17, 2013 at 3:31 AM, yi huang  wrote:
>>> I use cython 0.19.1, when compile following code:
>>>
>>> cdef void some_function():
>>>cdef char buf[sizeof(long)*8/3+6]
>>>
>>> Got error message:
>>>
>>> Error compiling Cython file:
>>> 
>>> ...
>>> cdef void some_function():
>>>cdef char buf[sizeof(long)*8/3+6]
>>>^
>>> 
>>>
>>> /tmp/test.pyx:2:17: Variable type 'char []' is incomplete
>>
>> That's an interesting one... it's a compile time value at C
>> compilation time, but not a Cython compilation time. I don't have a
>> quick fix.
>>
>
> That's an annoying error. I have never encountered it, but still it annoys me 
> :-(
>
> A quick fix is to use alloca instead
>
>  cdef char *buf = alloca(sizeof(long)*8/3+6)
>
> but beware that sizeof(buf) will be different.
>
> Sturla
>
>
>
>
>
> ___
> cython-devel mailing list
> cython-devel@python.org
> http://mail.python.org/mailman/listinfo/cython-devel



-- 
http://yi-programmer.com/
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


[Cython] [Bug] Don't compile lambda with tuple argument.

2015-11-09 Thread yi huang
λ $ cat /tmp/test.pyx
f = lambda (name,v):True

λ $ cython /tmp/test.pyx

Error compiling Cython file:

...
f = lambda (name,v):True
  ^


/tmp/test.pyx:1:19: Empty declarator


Tested with both 0.21 and 0.23
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] [Bug] Don't compile lambda with tuple argument.

2015-11-09 Thread yi huang
Even function with tuple match parameter don't work either.

```
def test((name, v)):
return True
```

```
Error compiling Cython file:

...
def test((name, v)):
 ^


/private/tmp/test.pyx:3:18: Empty declarator
```

On Tue, Nov 10, 2015 at 8:01 AM, yi huang  wrote:
> λ $ cat /tmp/test.pyx
> f = lambda (name,v):True
>
> λ $ cython /tmp/test.pyx
>
> Error compiling Cython file:
> 
> ...
> f = lambda (name,v):True
>   ^
> 
>
> /tmp/test.pyx:1:19: Empty declarator
>
>
> Tested with both 0.21 and 0.23



-- 
http://yi-programmer.com/
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel