Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Vitja Makarov <vitja.makarov-Re5JQEeQqe8AvxtiuMwx3w <at> public.gmane.org>
Subject: Re: [Cython] Cython 0.16: "eval" problem
Newsgroups: gmane.comp.python.cython.devel
Date: Monday 23rd April 2012 07:26:11 UTC (over 4 years ago)
2012/4/22 Vitja Makarov
:
> 2012/4/22 Nathan Dunfield :
>> 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})
>

Btw before 0.16 locals() weren't passed to eval. I've tried the
following code and it fails with 0.15:

def foo():
    cdef int *a
    return locals()


I've pushed fix to upstream/master
https://github.com/cython/cython/commit/0b133e00a7bc3c53ea60d3cf4ae8eb3e20ef49ec

-- 
vitja.
 
CD: 3ms