Opened 6 years ago

Closed 6 years ago

#17981 closed defect (fixed)

Fix when _coerce_map_from_ which returns a callable

Reported by: tscrim Owned by: tscrim
Priority: major Milestone: sage-6.6
Component: coercion Keywords:
Cc: nbrun, vbraun, jdemeyer Merged in:
Authors: Travis Scrimshaw Reviewers: Darij Grinberg
Report Upstream: N/A Work issues:
Branch: b0973dc (Commits) Commit: b0973dc8b5d147adcd3b2e4451efa8b3dbeeb912
Dependencies: Stopgaps:

Description

The following currently results in an error:

sage: class P(Parent):
....:     def __init__(self):
....:         Parent.__init__(self, category=Sets())
....:     def _coerce_map_from_(self, A):
....:         if A == ZZ:
....:             return lambda x: self.element_class(self, x)
....:         return False
....:     Element = ElementWrapper
....:     
sage: X = P()
sage: X.has_coerce_map_from(ZZ)

the reason is CallableConvertMap is not being given the correct input data.

Change History (7)

comment:1 Changed 6 years ago by tscrim

  • Branch set to public/coerce/fix_coerce_map_from_callable
  • Commit set to b0973dc8b5d147adcd3b2e4451efa8b3dbeeb912
  • Status changed from new to needs_review

New commits:

b0973dcFix coercion map when _coerce_map_from_ returns a callable.

comment:2 Changed 6 years ago by darij

  • Status changed from needs_review to positive_review

comment:3 Changed 6 years ago by darij

Positive review (sorry, I should have written this half a day ago).

comment:4 Changed 6 years ago by vbraun

  • Status changed from positive_review to needs_work

reviewer name

comment:5 Changed 6 years ago by darij

  • Reviewers set to Darij Grinberg
  • Status changed from needs_work to positive_review

comment:6 Changed 6 years ago by tscrim

Thanks Darij.

comment:7 Changed 6 years ago by vbraun

  • Branch changed from public/coerce/fix_coerce_map_from_callable to b0973dc8b5d147adcd3b2e4451efa8b3dbeeb912
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.