[IronPython] sympy on IP 2.6B2

Michael Foord fuzzyman at voidspace.org.uk
Sun Jul 26 18:18:54 CEST 2009


Jeffrey Sax wrote:
> Thanks Michael & Dino,
>
> That gets me a step further:
>
>   
>>>> from sympy import Symbol
>>>>         
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "c:\Program Files
> (x86)\Python26\Lib\site-packages\sympy\__init__.py", line 44, in c:\Program
> Files (x86)\Python26\Lib\site-packages\sympy\__init__.py
> NameError: global name 'evalf' is not defined
>   
>
>   

An undefined name is an undefined name. Sympy must be doing some magic 
somewhere to inject the name into the namespace.

> evalf is a module that is part of sympy.core. This works fine on CPython
> 2.6. I can get around the problem by commenting out the offending line,
> which doesn't seem to have any breaking side-effects.
>
> Still, given the performance degradation, it seems odd you have to turn
> frames on just to import a module regardless of whether you actually need
> the frames functionality. 
>   

The decision was to remove _getframe if frames are disabled. As Jython 
didn't used to define _getframe when it didn't have Python stack frames, 
so there is some code in standard library modules that will detect and 
workaround the absence of _getframe. Unfortunately there is a 
corresponding amount of code that assumes it is always there so it's a 
bit of a double bind.

All the best,

Michael Foord


> Jeffrey
>
>
> -----Original Message-----
> From: users-bounces at lists.ironpython.com
> [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland
> Sent: July-24-09 4:50 PM
> To: Discussion of IronPython
> Subject: Re: [IronPython] sympy on IP 2.6B2
>
> -X:FullFrames promotes all local variables into the heap.  So you can
> always crawl the stack and look/change them for all methods.
>
> -X:Frames only creates the frame objects and if something happens to
> make us promote local variables (e.g. a closure, or a call to locals(),
> exec, eval, dir(), vars()) then the local variables will be available
> for that specific method.
>
>   
>> -----Original Message-----
>> From: users-bounces at lists.ironpython.com [mailto:users-
>> bounces at lists.ironpython.com] On Behalf Of Michael Foord
>> Sent: Friday, July 24, 2009 1:47 PM
>> To: Discussion of IronPython
>> Subject: Re: [IronPython] sympy on IP 2.6B2
>>
>> Try running it with frames switched on:
>>
>>     ipy.exe -X:Frames
>>
>> or:
>>
>>     ipy.exe -X:FullFrames
>>
>> Perhaps Dino can explain what the difference is between these two
>> modes... :-)
>>
>> Michael
>>
>>     
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>   


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog





More information about the Ironpython-users mailing list