#20626: lazy_import'ed modules broken on introspection
-----------------------+----------------------------
Reporter: nthiery | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-7.3
Component: misc | Keywords:
Merged in: | Authors:
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies:
Stopgaps: |
-----------------------+----------------------------
*Steps to reproduce*: extract the attached archive containing a
trivial module bar lazy imported from a module foo in the current
directory, and run sage:
{{{
sage: import foo
sage: foo.bar?
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call
last)
<ipython-input-2-04fe32111b22> in <module>()
----> 1 get_ipython().magic(u'pinfo foo.bar')
/opt/sage-git/local/lib/python2.7/site-
packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2161 magic_name, _, magic_arg_s = arg_s.partition(' ')
2162 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2163 return self.run_line_magic(magic_name, magic_arg_s)
2164
2165
#-------------------------------------------------------------------------
... last 3 frames repeated, from the frame below ...
/opt/sage-git/local/lib/python2.7/site-packages/sage/misc/sageinspect.pyc
in sage_getdoc_original(obj)
1765 typ = type(obj)
1766
-> 1767 s,argspec =
_extract_embedded_signature(_sage_getdoc_unformatted(obj), typ.__name__)
1768 if s:
1769 pos = _extract_embedded_position(s)
RuntimeError: maximum recursion depth exceeded in __instancecheck__
}}}
*Analysis*: sage.misc.sageinspect.sage_getdoc_original gets confused
when detecting that `foo.bar` is of type `LazyImport` (and not module)
and trying to recover its documentation from there.
*Use case*: some Sage modules contain only documentation:
- `sage.combinat.tutorial`
- `sage.combinat.primer`
- `sage.modules.tutorial_free_module`
- `sage.categories.primer`
- `sage.categories.tutorial`
and more will come. It would be nice to lazy import them to reduce the
memory and startup footprint.
--
Ticket URL: <http://trac.sagemath.org/ticket/20626>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.