#7504 closed defect (fixed)
Magma booleans don't evaluate correctly in boolean contexts
Reported by: | kedlaya | Owned by: | was |
---|---|---|---|
Priority: | major | Milestone: | sage-4.3 |
Component: | interfaces | Keywords: | magma, boolean context |
Cc: | Merged in: | sage-4.3.alpha1 | |
Authors: | William Stein | Reviewers: | Kiran Kedlaya |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Compare the following results:
sage: bool(pari(False)) False sage: bool(gap(False)) False sage: bool(maxima(False)) False sage: bool(maple(False)) False sage: bool(mathematica(False)) False sage: bool(magma(False)) True
This is in some sense the inverse problem to #845.
Attachments (1)
Change History (8)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
Ouch, I give up after experimenting further and getting (one and the same session!):
sage: magma(False).bool() False sage: bool(magma(False)) True
comment:3 Changed 13 years ago by
bool(f)
calls f.__nonzero__()
comment:4 Changed 12 years ago by
- Report Upstream set to N/A
- Status changed from new to needs_review
In Magma we have:
> false ne 0; >> false ne 0; ^ Runtime error in 'ne': Bad argument types Argument types given: BoolElt, RngIntElt > 1 ne 0; true
I.e., comparing false to 0 is not allowed in Magma. So we need to add code to nonzero that also tests bools.
Changed 12 years ago by
comment:5 Changed 12 years ago by
- Status changed from needs_review to positive_review
This applied against 4.2, fixed the issue for me, and doesn't appear to have caused any failures of optional doctests.
comment:6 Changed 12 years ago by
- Merged in set to sage-4.3.alpha1
- Resolution set to fixed
- Reviewers set to Kiran Kedlaya
- Status changed from positive_review to closed
comment:7 Changed 12 years ago by
- Milestone set to sage-4.3
Note: See
TracTickets for help on using
tickets.
In "gap.py", in the "class GapElement?(ExpectElement?)", there is (lines 1058 ff):
I didn't check maxima.py, ... but in magma.py, I couldn't find a counterpart in the class MagmaElement?. My first attempt to add this with the obvious minor modifications failed however (so I do not post the patch):