Skip to content

Commit 0e8d18f

Browse files
lxbrtschplusvic
authored andcommitted
Adding iterator reset for Rules iteration (#59)
When iterating over a Rules object, the iteration would work for a single pass before throwing a StopIteration exception. This slightly changes the iteration logic to reset to the iteration list head after a full iteration has been completed.
1 parent b53ffc8 commit 0e8d18f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

yara-python.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,7 @@ static PyObject* Rules_next(
12781278

12791279
if (RULE_IS_NULL(rules->iter_current_rule))
12801280
{
1281+
rules->iter_current_rule = rules->rules->rules_list_head;
12811282
PyErr_SetNone(PyExc_StopIteration);
12821283
return NULL;
12831284
}

0 commit comments

Comments
 (0)