Opened 11 years ago

Closed 6 years ago

#3865 closed defect (fixed)

Bug in conversion from gp elements to p-adics

Reported by: craigcitro Owned by: craigcitro
Priority: major Milestone: sage-5.12
Component: interfaces Keywords: sd51
Cc: Merged in: sage-5.12.beta2
Authors: David Loeffler Reviewers: Jan Tuitman
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by davidloeffler)

David Loeffler ran into the following:

sage: v = gp.polrootspadic(x^2-2, 7, 20)[1]
sage: R = Zp(7, 10, "capped-rel")
sage: R(v)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/Users/craigcitro/<ipython console> in <module>()

/Users/craigcitro/three-one/local/lib/python2.5/site-packages/sage/rings/padics/padic_generic.py in __call__(self, x, absprec, relprec)
     82             Casts x into self.  Uses the constructor of self._element_class.
     83         """
---> 84         return self._element_class(self, x, absprec, relprec)
     85 
     86     def _coerce_impl(self, x):

/Users/craigcitro/padic_capped_relative_element.pyx in sage.rings.padics.padic_capped_relative_element.pAdicCappedRelativeElement.__init__ (sage/rings/padics/padic_capped_relative_element.c:4872)()

/Users/craigcitro/rational.pyx in sage.rings.rational.Rational.__init__ (sage/rings/rational.c:3767)()

/Users/craigcitro/rational.pyx in sage.rings.rational.Rational.__set_value (sage/rings/rational.c:4567)()

/Users/craigcitro/three-one/local/lib/python2.5/site-packages/sage/interfaces/expect.py in _rational_(self)
   1393     def _rational_(self):
   1394         import sage.rings.all
-> 1395         return sage.rings.all.Rational(repr(self))
   1396 
   1397     def name(self, new_name=None):

/Users/craigcitro/rational.pyx in sage.rings.rational.Rational.__init__ (sage/rings/rational.c:3767)()

/Users/craigcitro/rational.pyx in sage.rings.rational.Rational.__set_value (sage/rings/rational.c:4533)()

TypeError: unable to convert 3 + 7 + 2*7^2 + 6*7^3 + 7^4 + 2*7^5 + 7^6 + 2*7^7 + 4*7^8 + 6*7^9 + 6*7^10 + 2*7^11 + 7^12 + 7^13 + 2*7^15 + 7^16 + 7^17 + 4*7^18 + 6*7^19 + O(7^20) to a rational

The trouble is that the code in the __init__ method for pAdicCappedRelativeElements only looks for Pari gen objects, not GpElements. The fix should be trivial, but I'm going to look at it tomorrow.

Attachments (1)

trac_3865.patch (10.4 KB) - added by davidloeffler 6 years ago.
Patch against 5.11.beta3

Download all attachments as: .zip

Change History (8)

comment:1 Changed 11 years ago by mabshoff

Tick Tick :p

Cheers,

Michael

Changed 6 years ago by davidloeffler

Patch against 5.11.beta3

comment:2 Changed 6 years ago by davidloeffler

  • Authors set to David Loeffler
  • Description modified (diff)
  • Report Upstream set to N/A
  • Status changed from new to needs_review

... tock. :-)

comment:3 Changed 6 years ago by davidloeffler

  • Keywords sd51 added

comment:4 Changed 6 years ago by jantuitman

  • Status changed from needs_review to positive_review

looks good and works!

comment:5 Changed 6 years ago by AlexGhitza

  • Reviewers set to Jan Tuitman

comment:6 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:7 Changed 6 years ago by jdemeyer

  • Merged in set to sage-5.12.beta2
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.