[Cython] Cython 0.16: "eval" problem

Vitja Makarov vitja.makarov at gmail.com
Sun Apr 22 20:50:23 CEST 2012


2012/4/22 Nathan Dunfield <nmd at illinois.edu>:
> On Apr 22, 2012, at 1:22 PM, Vitja Makarov wrote:
>> Oops, it seems to be a problem with locals() dict creation.
>
> Yes it does.   The following variants of my original example both work:
>
> ## prob.pyx version 1
>
> def cy_eval(s):
>    return eval(s)
>
> def f(x):
>    cdef int* p
>    return cy_eval(x)
>
> ## prob.pyx version 2
>
> def f(x):
>    cdef int* p
>    return eval(x, {})
>
> Best,
>
>        Nathan
>

I've fixed it here:
https://github.com/vitek/cython/commit/6dc132731b8f3f7eaabf55e51d89bcbc7b8f4eb7

Now waiting for jenkins, then I'll push it into upstream. As a
workaround you can manually pass locals dictionary, e.g.:

eval(x, None, {'a: a})

-- 
vitja.


More information about the cython-devel mailing list