Ticket #4376: 4376_no_strings.patch

File 4376_no_strings.patch, 1.7 KB (added by jdemeyer, 12 years ago)

Apply on top of previous patch

  • sage/rings/power_series_ring_element.pyx

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1296140175 -3600
    # Node ID 65f9ee74bab783e5fe303af748f0b6840525128d
    # Parent  ba96e49c19b5a372574359b189ad7d927ed3efd0
    #4376: Avoid strings in conversion of power series to PARI
    
    diff -r ba96e49c19b5 -r 65f9ee74bab7 sage/rings/power_series_ring_element.pyx
    a b  
    112112import rational_field, integer_ring
    113113from integer import Integer
    114114from sage.rings.finite_rings.integer_mod_ring import IntegerModRing
    115 import sage.libs.pari.all
     115from sage.libs.pari.all import pari
    116116from sage.libs.all import PariError
    117117from sage.misc.functional import sqrt, log
    118118from sage.rings.arith import integer_ceil as ceil
     
    17371737            sage: R.<x> = Zmod(6)[[]]
    17381738            sage: pari(1 + x + 8*x^3 + O(x^8)) # indirect doctest
    17391739            Mod(1, 6) + Mod(1, 6)*x + Mod(2, 6)*x^3 + O(x^8)
     1740
     1741        TESTS::
     1742
     1743            sage: pari(1 + O(x^1))
     1744            Mod(1, 6) + O(x)
     1745            sage: pari(O(x^1))
     1746            O(x)
     1747            sage: pari(O(x^0))
     1748            O(1)
    17401749        """
    17411750        n = self.prec()
    17421751        if n is infinity:
    17431752            raise ValueError, "series precision must be finite for conversion to pari object."
    1744         s = '+'.join([str(self.truncate()._pari_()), 'O(%s^%s)' % (self.variable(), n)])
    1745         return sage.libs.pari.all.pari(s)
     1753        s = self.truncate()._pari_()  # PARI polynomial
     1754        s += pari('O(%s^%d)' % (s.variable(), n))  # PARI series
     1755        return s
    17461756
    17471757def _solve_linear_de(R, N, L, a, b, f0):
    17481758    r"""