[Cython] broken array declarators when size is an expression
Stefan Behnel
stefan_ml at behnel.de
Sat Nov 15 09:14:06 CET 2008
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.
Stefan
More information about the Cython-dev
mailing list