Opened 3 years ago
Closed 3 years ago
#24515 closed defect (duplicate)
Lazy import fails in some files
Reported by: | rws | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | cython | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
When I move the function create_RealField
from rings/real_mpfr.pyx
to the file rings/real_field.py
and put these lines into arith/misc.py
:
from sage.misc.lazy_import import lazy_import lazy_import('sage.rings.real_field', 'create_RealField', deprecation=24511)
then trying to import will give me the expected message:
sage: from sage.arith.misc import create_RealField sage: create_RealField() /home/ralf/sage/local/lib/python2.7/site-packages/IPython/core/interactiveshell.py:2882: DeprecationWarning: Importing create_RealField from here is deprecated. If you need to use it, please import it directly from sage.rings.real_field See http://trac.sagemath.org/24511 for details. exec(code_obj, self.user_global_ns, self.user_ns) Real Field with 53 bits of precision
But when I put it in rings/real_mpfr.pyx
trying to import gets me:
sage: from sage.rings.real_mpfr import create_RealField --------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-1-8a8c7bec5f0f> in <module>() ----> 1 from sage.rings.real_mpfr import create_RealField ImportError: cannot import name create_RealField
Importing from real_field
directly works nicely. So, I'm conjecturing that lazy_import does not work in Cython files.
Change History (1)
comment:1 Changed 3 years ago by
- Milestone changed from sage-8.2 to sage-duplicate/invalid/wontfix
- Resolution set to duplicate
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.
Duplicate of #22752