Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
consume the iterator if running ignore_subsets after only_subsets
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Kliem committed May 20, 2021
1 parent ff87201 commit a1b4c12
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -491,15 +491,14 @@ cdef class FaceIterator_base(SageObject):
...
ValueError: only possible when not in dual mode
Cannot run ``ignore_subfaces`` after ``only_subfaces::
Ignoring the same face as was requested to visit only consumes the iterator::
sage: it = C.face_iter(dual=False)
sage: _ = next(it)
sage: it.only_subfaces()
sage: it.ignore_subfaces()
Traceback (most recent call last):
...
ValueError: cannot ignore a face after setting iterator to only visit subsets
sage: list(it)
[]
Face iterator must be set to a face first::
Expand Down Expand Up @@ -1009,7 +1008,10 @@ cdef class FaceIterator_base(SageObject):
if unlikely(self.structure.face_status == 0):
raise ValueError("iterator not set to a face yet")
if unlikely(self.structure.face_status == 3):
raise ValueError("cannot ignore a face after setting iterator to only visit subsets")
# The iterator is consumed, if it was just set to visit only subsets
# next thing to ignore subsets.
self.structure.current_dimension = self.structure.dimension
return 0
if unlikely(self.structure.face_status == 2):
# Nothing to do.
return 0
Expand Down

0 comments on commit a1b4c12

Please sign in to comment.