[Cython] broken array declarators when size is an expression
Robert Bradshaw
robertwb at math.washington.edu
Tue Nov 18 11:35:56 CET 2008
On Nov 15, 2008, at 12:14 AM, Stefan Behnel wrote:
> Hi,
>
> Lisandro Dalcin wrote:
>> changeset: 1333:34aca76e1b9d
>> summary: array size must be set as int, not numeric string
>>
>> broke mpi4py and petsc4py, where I use stack-allocated arrays where
>> the size comes from an (external) enumeration, for example:
>>
>> cdef char name[MPI_MAX_OBJECT_NAME+1]
>
> Sorry for that. The problem is that we don't currently have a way
> to say "give
> me the compile-time result for this subtree, but don't complain if
> it's a
> runtime value". I already needed that in a couple of places when
> working on
> Cython, as it can lead to different code when you know the result
> of an
> expression. I just never got around to implement this.
>
> I think it's wrong that compile_time_value() raises a compiler
> error. It
> should rather return the result with a hint if it was determined
> completely or
> if part of it is runtime-determined. Then the caller can decide
> what to do
> with this information.
This has annoyed me too. http://trac.cython.org/cython_trac/ticket/119
- Robert
More information about the Cython-dev
mailing list