Skip to content

Commit

Permalink
remove dead code, release gil on increment (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikmuhs authored May 16, 2024
1 parent a6c2168 commit f63eebf
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions python/src/addons/match_iterator.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,18 @@ cdef class MatchIterator:
cdef _MatchIterator it
cdef _MatchIterator end

#def __cinit__(self, ):
# self.end = new _MatchIterator()

# Most likely, you will be calling this directly from this
# or another Cython module, not from Python.
#cdef set_iter(self, _MatchIterator it):
# self.it = it

def __iter__(self):
return self

#def __dealloc__(self):
# This works by calling "delete" in C++, you should not
# fear that Cython will call "free"
# del self.it
# del self.end

def __next__(self):
# This works correctly by using "*it" and "*end" in the code,
#if co.dereference( self.it ) == co.dereference( self.end ) :
if self.it == self.end:

raise StopIteration()
cdef _Match * _r = new _Match(co.dereference( self.it ))

# This also does the expected thing.
co.preincrement( self.it )

with nogil:
co.preincrement( self.it )

cdef Match py_result = Match.__new__(Match)
py_result.inst = shared_ptr[_Match](_r)

Expand Down

0 comments on commit f63eebf

Please sign in to comment.