Skip to content

Commit

Permalink
sagemathgh-39182: Define __iter__ method in iterator types
Browse files Browse the repository at this point in the history
    
This is required for iterator types and seems to be enforced in Python
3.13

https://docs.python.org/3/library/stdtypes.html#iterator-types
    
URL: sagemath#39182
Reported by: Antonio Rojas
Reviewer(s): user202729
  • Loading branch information
Release Manager committed Jan 6, 2025
2 parents 7d92748 + 9ec9a9a commit 4a61fa8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/sage/matroids/extension.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ cdef class LinearSubclassesIter:

self._nodes = [first_cut]

def __iter__(self):
return self

def __next__(self):
"""
Return the next linear subclass.
Expand Down
3 changes: 3 additions & 0 deletions src/sage/matroids/set_system.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,9 @@ cdef class SetSystemIterator:
self._pointer = -1
self._len = len(H)

def __iter__(self):
return self

def __next__(self):
"""
Return the next subset of a SetSystem.
Expand Down

0 comments on commit 4a61fa8

Please sign in to comment.