#12446: sage access in cython_lambda broken
-----------------------+----------------------------------------------------
   Reporter:  schilly  |          Owner:  jason   
       Type:  defect   |         Status:  new     
   Priority:  minor    |      Milestone:  sage-5.0
  Component:  misc     |       Keywords:          
Work_issues:           |       Upstream:  N/A     
   Reviewer:           |         Author:          
     Merged:           |   Dependencies:          
-----------------------+----------------------------------------------------
 this is a quote from cython_lambda's documentation.

 {{{
 We access a global function and variable.
  sage: a = 25 sage: f = cython_lambda('double x',
  'sage.math.sin(x) + sage.a')                 # optional -- gcc
   sage: f(10)
 }}}

 apart from the missing newline, this doesn't work.

 {{{
 sage: a = 25; f = cython_lambda('double x','sage.math.sin(x) + sage.a')
 sage: f(1)
 ---------------------------------------------------------------------------
 KeyError                                  Traceback (most recent call
 last)

 /home/harri/Programming/psnobfit/<ipython console> in <module>()

 
/home/harri/.sage/temp/x220/11839/spyx/_home_harri__sage_temp_x220_11839_tmp_0_spyx/_home_harri__sage_temp_x220_11839_tmp_0_spyx_0.so
 in _home_harri__sage_temp_x220_11839_tmp_0_spyx_0.f
 (_home_harri__sage_temp_x220_11839_tmp_0_spyx_0.c:621)()
      11 sage = _s()
      12
      13 def f(double x):
 ---> 14  return sage.math.sin(x) + sage.a
      15
 
/home/harri/.sage/temp/x220/11839/spyx/_home_harri__sage_temp_x220_11839_tmp_0_spyx/_home_harri__sage_temp_x220_11839_tmp_0_spyx_0.so
 in _home_harri__sage_temp_x220_11839_tmp_0_spyx_0._s.__getattr__
 (_home_harri__sage_temp_x220_11839_tmp_0_spyx_0.c:559)()
       7 class _s:
       8    def __getattr__(self, x):
 ----> 9        return globals()[x]
      10
      11 sage = _s()

 KeyError: 'math'
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12446>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to