Opened 7 years ago
Last modified 6 years ago
#18251 new defect
CombinatorialFreeModule should use coercion for comparisons — at Version 5
Reported by: | tscrim | Owned by: | tscrim |
---|---|---|---|
Priority: | critical | Milestone: | sage-7.4 |
Component: | coercion | Keywords: | zero |
Cc: | nthiery, darij, nbruin, robertwb, chapoton, vdelecroix | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
Currently we have the following in Sage:
sage: C = CombinatorialFreeModule(QQ, ['a','b']) sage: C.zero() == ZZ(0) True sage: C.zero() == QQ(0) False
This should be fixed by using coercing comparison (_cmp_
or _richcmp_
).
The fix is this ticket is meant to be an example for other plain Python modules which need to implement comparison using coercion.
We need access to the CPython function PyObject_RichCompare()
which —as far as I know— is not exposed by Python. So we add a Python interface to PyObject_RichCompare()
called richcmp()
.
Change History (5)
comment:1 Changed 6 years ago by
- Description modified (diff)
- Summary changed from Equality comparison with 0 is not consistant to CombinatorialFreeModule should use coercion for comparisons
comment:2 Changed 6 years ago by
- Cc chapoton added
- Description modified (diff)
comment:3 Changed 6 years ago by
- Description modified (diff)
- Milestone changed from sage-6.7 to sage-7.4
comment:4 Changed 6 years ago by
- Cc vdelecroix added
comment:5 Changed 6 years ago by
- Description modified (diff)
Note: See
TracTickets for help on using
tickets.