Opened 12 years ago
Closed 12 years ago
#8671 closed defect (fixed)
FieldElement.quo_rem broken
Reported by: | burcin | Owned by: | burcin |
---|---|---|---|
Priority: | major | Milestone: | sage-4.4.4 |
Component: | basic arithmetic | Keywords: | |
Cc: | Merged in: | sage-4.4.4.alpha0 | |
Authors: | Burcin Erocal | Reviewers: | John Cremona |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
sage: P.<n> = QQ[] sage: F = P.fraction_field() sage: P.one_element()//F.one_element() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) .../sage/rings/polynomial/polynomial_element.so in sage.rings.polynomial.polynomial_element.Polynomial.__floordiv__ (sage/rings/polynomial/polynomial_element.c:14608)() .../sage/structure/element.so in sage.structure.element.NamedBinopMethod.__call__ (sage/structure/element.c:22812)() .../sage/structure/element.so in sage.structure.element.FieldElement.quo_rem (sage/structure/element.c:16670)() ... AttributeError: 'sage.rings.fraction_field_element.FractionFieldElement' object has no attribute '_parent'
Attachments (1)
Change History (6)
Changed 12 years ago by
comment:1 Changed 12 years ago by
- Status changed from new to needs_review
comment:2 Changed 12 years ago by
comment:3 Changed 12 years ago by
_parent
is a cdef'd attribute. At the point this code is used, Cython doesn't know that right
is an Element
, so it generates code to look for a python attribute _parent
which fails.
One solution would be to use a type cast by writing (<Element>right)._parent
, but we'd have to handle python types like int
manually before this. The function parent()
, which in turn calls sage.structure.parent.parent_c
is used exactly for this purpose.
Calling parent_c directly would be faster, but that is not exported in sage/structure/parent.pxd
.
comment:4 Changed 12 years ago by
- Status changed from needs_review to positive_review
That makes sense.
Patch applies fine to 4.4.2.rc0 and tests in sage/structure and sage/rings/ pass. So, positive review.
comment:5 Changed 12 years ago by
- Merged in set to sage-4.4.4.alpha0
- Resolution set to fixed
- Reviewers set to John Cremona
- Status changed from positive_review to closed
I'm worried by the fact that right._parent fails while parent(right) succeeds.