# Ticket #13620: trac_13620.patch

File trac_13620.patch, 3.0 KB (added by saraedum, 8 years ago)
• ## sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py

```# HG changeset patch
# User Julian Rueth <julian.rueth@gmail.com>
# Date 1350615789 0
# Node ID 7ffe38b585130075a207b9069d9f0d72c0e231d6
# Parent  698ec14c513f99fa5a3a7aeca982cc14fd249a89
Trac #13620: initialization of padic polynomial from empty dict

diff --git a/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py b/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py```
 a Polynomial_integer_dense = sage.rings.polynomial.polynomial_integer_dense_ntl.Po class Polynomial_padic_capped_relative_dense(Polynomial_generic_domain): def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, absprec = infinity, relprec = infinity): """ TESTS: TESTS:: sage: K = Qp(13,7) sage: R. = K[] sage: R([K(13), K(1)]) class Polynomial_padic_capped_relative_dense(Polynomial_generic_domain): sage: T. = ZZ[] sage: R(t + 2) (1 + O(13^7))*t + (2 + O(13^7)) Check that :trac:`13620` has been fixed:: sage: f = R.zero() sage: R(f.dict()) 0 """ Polynomial.__init__(self, parent, is_gen=is_gen) parentbr = parent.base_ring() class Polynomial_padic_capped_relative_dense(Polynomial_generic_domain): check = False elif isinstance(x, dict): zero = parentbr.zero_element() n = max(x.keys()) n = max(x.keys()) if len(x) else 0 v = [zero for _ in xrange(n + 1)] for i, z in x.iteritems(): v[i] = z
• ## sage/rings/polynomial/padics/polynomial_padic_flat.py

`diff --git a/sage/rings/polynomial/padics/polynomial_padic_flat.py b/sage/rings/polynomial/padics/polynomial_padic_flat.py`
 a import sage.rings.padics.misc class Polynomial_padic_flat(Polynomial_generic_dense): def __init__(self, parent, x=None, check=True, is_gen=False, construct=False, absprec=None): """ Initialization function for the class  Polynomial_padic_flat. TESTS: Check that :trac:`13620` has been fixed:: sage: K = ZpFM(3) sage: R. = K[] sage: R(R.zero()) 0 """ if x is None: Polynomial_generic_dense.__init__(self, parent, x = None, is_gen = is_gen) return class Polynomial_padic_flat(Polynomial_generic_dense): if check: m = infinity zero = R(0) n = max(x.keys()) n = max(x.keys()) if len(x) else 0 v = [zero for _ in xrange(n+1)] for i, z in x.iteritems(): v[i] = R(z)