Ticket #22561: gen_pyx.patch

File gen_pyx.patch, 716 bytes (added by culler, 5 years ago)

patch

  • src/sage/libs/cypari2/gen.pyx

    diff --git a/src/sage/libs/cypari2/gen.pyx b/src/sage/libs/cypari2/gen.pyx
    index 5f0f5c9..0602dd2 100644
    a b cdef class gen(gen_auto): 
    946946                v[i] = self[j]
    947947            return v
    948948
    949         ## there are no "out of bounds" problems
    950         ## for a polynomial or power series, so these go before
    951         ## bounds testing
    952949        if pari_type == t_POL:
    953             return self.polcoeff(n)
     950            if 0 <= n <= self.poldegree():
     951                return self.polcoeff(n)
     952            raise IndexError("index out of range")
    954953
    955954        elif pari_type == t_SER:
    956955            bound = valp(self.g) + lg(self.g) - 2