Opened 5 years ago
Closed 11 months ago
#12482 closed defect (fixed)
isinstance failure on lazy imported class
Reported by: | nthiery | Owned by: | jason |
---|---|---|---|
Priority: | major | Milestone: | sage-6.4 |
Component: | misc | Keywords: | Cernay2012 |
Cc: | rishi, jason, rlm, rbradshaw | Merged in: | |
Authors: | Jeroen Demeyer | Reviewers: | Volker Braun |
Report Upstream: | N/A | Work issues: | |
Branch: | 8528515 (Commits) | Commit: | 85285159cb0348786a148587cebfceae6f8d36ca |
Dependencies: | Stopgaps: |
Description (last modified by )
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 PEP 3119.
Change History (12)
comment:1 Changed 5 years ago by
- Description modified (diff)
comment:2 Changed 5 years ago by
- Keywords Cernay2012 added
comment:3 Changed 3 years ago by
- Milestone changed from sage-5.11 to sage-5.12
comment:4 Changed 3 years ago by
- Milestone changed from sage-6.1 to sage-6.2
comment:5 Changed 2 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:6 Changed 2 years ago by
- Milestone changed from sage-6.3 to sage-6.4
comment:7 Changed 11 months ago by
- Description modified (diff)
comment:8 Changed 11 months ago by
- Branch set to u/jdemeyer/isinstance_failure_on_lazy_imported_class
comment:9 Changed 11 months ago by
- Commit set to 85285159cb0348786a148587cebfceae6f8d36ca
- Status changed from new to needs_review
comment:10 Changed 11 months ago by
- Reviewers set to Volker Braun
- Status changed from needs_review to positive_review
comment:11 Changed 11 months ago by
Nicely done Jeroen! Thanks a lot, that will make lazy imported classes much more practical and safe.
comment:12 Changed 11 months ago by
- Branch changed from u/jdemeyer/isinstance_failure_on_lazy_imported_class to 85285159cb0348786a148587cebfceae6f8d36ca
- Resolution set to fixed
- Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
New commits:
Trac #12482: Support isinstance() and issubclass()