Skip to content

Commit

Permalink
Fixing a broken doctest by better testing for 0; using self.one().
Browse files Browse the repository at this point in the history
  • Loading branch information
tscrim committed Sep 7, 2023
1 parent 5514c89 commit 4b88180
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/sage/data_structures/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -3358,7 +3358,7 @@ def _advance(self):
"""
if self._cur is None:
temp = next(self._op_iter)
if not temp:
if isinstance(temp._coeff_stream, Stream_zero):
self._advance()
return
self.initial(temp)
Expand All @@ -3370,7 +3370,7 @@ def _advance(self):
except StopIteration:
self._cur_order = infinity
return
if not next_factor:
if isinstance(next_factor._coeff_stream, Stream_zero):
continue
coeff_stream = next_factor._coeff_stream
while coeff_stream._approximate_order < order:
Expand Down
4 changes: 2 additions & 2 deletions src/sage/rings/lazy_series_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ def prod(self, f, a=None, b=infinity, add_one=False):
elif a in ZZ:
if b != infinity:
if add_one:
return super().prod(1 + f(i) for i in range(a, b+1))
return super().prod(self.one() + f(i) for i in range(a, b+1))
return super().prod(f(i) for i in range(a, b+1))
from sage.sets.non_negative_integers import NonNegativeIntegers
it = (f(i+a) for i in NonNegativeIntegers())
Expand All @@ -983,7 +983,7 @@ def prod(self, f, a=None, b=infinity, add_one=False):

# NOTE: We must have a new variable name for each new iterator
if not add_one:
data = (g - 1 for g in it)
data = (g - self.one() for g in it)
else:
data = it

Expand Down

0 comments on commit 4b88180

Please sign in to comment.