#12482: isinstance failure on lazy imported class
----------------------------------+------------------------
Reporter: nthiery | Owner: jason
Type: defect | Status: new
Priority: major | Milestone: sage-6.4
Component: misc | Resolution:
Keywords: Cernay2012 | Merged in:
Authors: Jeroen Demeyer | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
----------------------------------+------------------------
Changes (by {'newvalue': u'Jeroen Demeyer', 'oldvalue': ''}):
* author: => Jeroen Demeyer
Old description:
> isinstance may fail on a lazy imported class, which can cause hard to
> track history-dependent failures (just been hit: #12483)::
>
> {{{
> sage: lazy_import('sage.rings.rational_field', 'RationalField')
> sage: isinstance(QQ, RationalField)
> False
> sage: isinstance(QQ, RationalField)
> True
> }}}
>
> Would there be a way to ensure that isinstance triggers the importing of
> the class *before* its use?
New description:
isinstance may fail on a lazy imported class, which can cause hard to
track history-dependent failures (just been hit: #12483)::
{{{
sage: lazy_import('sage.rings.rational_field', 'RationalField')
sage: isinstance(QQ, RationalField)
False
sage: isinstance(QQ, RationalField)
True
}}}
We fix this using the mechanism from
[https://www.python.org/dev/peps/pep-3119/ PEP 3119].
--
--
Ticket URL: <http://trac.sagemath.org/ticket/12482#comment:7>
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.