[text] allow calling 'extract_iter' with invalid arguments

This commit is contained in:
Mike Fährmann
2025-03-02 10:44:06 +01:00
parent 472ea737d8
commit db19990a82
2 changed files with 9 additions and 3 deletions

View File

@@ -160,10 +160,10 @@ def extract_all(txt, rules, pos=0, values=None):
def extract_iter(txt, begin, end, pos=0):
"""Yield values that would be returned by repeated calls of extract()"""
index = txt.index
lbeg = len(begin)
lend = len(end)
try:
index = txt.index
lbeg = len(begin)
lend = len(end)
while True:
first = index(begin, pos) + lbeg
last = index(end, first)