#26519 closed enhancement (fixed)

py3: care for islice

Reported by: chapoton Owned by:
Priority: major Milestone: sage-8.5
Component: python3 Keywords:
Cc: Merged in:
Authors: Frédéric Chapoton, Vincent Klein Reviewers: Frédéric Chapoton, Vincent Klein
Report Upstream: N/A Work issues:
Branch: 3baaea2 (Commits) Commit: 3baaea2a8199df646e5f51c9303ece5089d7a489
Dependencies: Stopgaps:

Description


Change History (12)

comment:1 Changed 14 months ago by chapoton

  • Branch set to u/chapoton/26519
  • Commit set to 7b2e58dd8e428275bf6cd32148ef2d544be7ff8e
  • Status changed from new to needs_review

New commits:

7b2e58dpy3: wrapping islice args with int

comment:2 Changed 14 months ago by vklein

  • Owner changed from (none) to vklein

comment:3 Changed 14 months ago by vklein

There is some remaining "islice" errors cases on the modified lines. I propose the patch below:

diff --git a/src/sage/rings/padics/local_generic_element.pyx b/src/sage/rings/padics/local_generic_element.pyx
index efb934b..3e89b37 100644
--- a/src/sage/rings/padics/local_generic_element.pyx
+++ b/src/sage/rings/padics/local_generic_element.pyx
@@ -344,7 +344,7 @@ cdef class LocalGenericElement(CommutativeRingElement):
         # construct the return value
         ans = self.parent().zero()
         for c in islice(self.expansion(lift_mode=lift_mode),
-                        int(start), int(stop), k):
+                        int(start), int(stop), int(k)):
             ans += ppow * c
             ppow *= pk
 
diff --git a/src/sage/rings/valuation/augmented_valuation.py b/src/sage/rings/valuation/augmented_valuation.py
index 5042977..cacd1ed 100644
--- a/src/sage/rings/valuation/augmented_valuation.py
+++ b/src/sage/rings/valuation/augmented_valuation.py
@@ -1817,7 +1817,7 @@ class FiniteAugmentedValuation(AugmentedValuation_base, FiniteInductiveValuation
             for i in range(f.degree(), -1, -1):
                 j = i // self.phi().degree()
                 from itertools import islice
-                coefficients = list(islice(f.list(), j * self.phi().degree(),
+                coefficients = list(islice(f.list(), int(j * self.phi().degree()),
                                            int(i) + 1))
                 g = self.domain()(coefficients)
                 ng = self._base_valuation.simplify(g, error=error-j*self._mu, force=force, phiadic=False)
Last edited 14 months ago by vklein (previous) (diff)

comment:4 Changed 14 months ago by vklein

  • Owner changed from vklein to (none)

comment:5 Changed 14 months ago by chapoton

ok, go on

comment:6 Changed 14 months ago by chapoton

Do you want me to add these fixes, or are you going to do that ?

comment:7 Changed 14 months ago by vklein

  • Branch changed from u/chapoton/26519 to u/vklein/26519

comment:8 Changed 14 months ago by vklein

  • Authors changed from Frédéric Chapoton to Frédéric Chapoton, Vincent Klein
  • Commit changed from 7b2e58dd8e428275bf6cd32148ef2d544be7ff8e to 3baaea2a8199df646e5f51c9303ece5089d7a489

New commits:

3baaea2Trac #26519: Fix some islice

comment:9 Changed 14 months ago by vklein

I give positive review to 7b2e58d except for the two lines fixed by 3baaea2

comment:10 Changed 14 months ago by vklein

@chapoton as i can't review my own commit i let you do that.

comment:11 Changed 14 months ago by chapoton

  • Reviewers set to Frédéric Chapoton, Vincent Klein
  • Status changed from needs_review to positive_review

ok, good to go from my side

comment:12 Changed 14 months ago by vbraun

  • Branch changed from u/vklein/26519 to 3baaea2a8199df646e5f51c9303ece5089d7a489
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.