#16522: maxima_calculus is not imported properly
------------------------+----------------------------
   Reporter:  nbruin    |            Owner:
       Type:  defect    |           Status:  new
   Priority:  minor     |        Milestone:  sage-6.3
  Component:  calculus  |         Keywords:
  Merged in:            |          Authors:
  Reviewers:            |  Report Upstream:  N/A
Work issues:            |           Branch:
     Commit:            |     Dependencies:
   Stopgaps:            |
------------------------+----------------------------
 We have the problem:
 {{{
 calculus/all.py:1:from calculus import maxima as maxima_calculus
 }}}
 This doesn't work, because this is a `LazyImport` proxy, which needs to
 know the namespace in which it is bound to do the proper replacement. This
 one is tied to `sage.calculus.calculus.maxima`, so it can't rebind the
 global `maxima_calculus`. Indeed:
 {{{
 sage: type(sage.calculus.calculus.maxima)
 <type 'sage.misc.lazy_import.LazyImport'>
 sage: type(maxima_calculus)
 <type 'sage.misc.lazy_import.LazyImport'>
 sage: hash(maxima_calculus)
 -7971541566211231133
 sage: type(sage.calculus.calculus.maxima)
 <class 'sage.interfaces.maxima_lib.MaximaLib'>
 sage: type(maxima_calculus)
 <type 'sage.misc.lazy_import.LazyImport'>
 }}}
 If instead we do:
 {{{
 sage: lazy_import('sage.interfaces.maxima_lib','maxima','maxima_calculus')
 }}}
 we see that things do resolve:
 {{{
 sage: type(maxima_calculus)
 <type 'sage.misc.lazy_import.LazyImport'>
 sage: hash(maxima_calculus)
 -7971541566211231133
 sage: type(maxima_calculus)
 <class 'sage.interfaces.maxima_lib.MaximaLib'>
 }}}
 Other bindings need their own chance to resolve, but do:
 {{{
 sage: type(sage.calculus.calculus.maxima)
 <type 'sage.misc.lazy_import.LazyImport'>
 sage: hash(sage.calculus.calculus.maxima)
 -7971541566211231133
 sage: type(sage.calculus.calculus.maxima)
 <class 'sage.interfaces.maxima_lib.MaximaLib'>
 }}}
 So, the proposed fix: in `calculus.all`, import `maximalib` directly and
 lazily, rather than indirectly from `sage.calculus.calculus`. !LazyImports
 can't handle indirect imports.

--
Ticket URL: <http://trac.sagemath.org/ticket/16522>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to