Skip to content

Commit

Permalink
In Submodule.iter_items, don't attach second empty iterator
Browse files Browse the repository at this point in the history
This fixes the minor bug where a separate empty iterator was bound
to the StopIteration exception raised as a result of returning from
the generator function (#1779).

This change does not cause what exceptions are raised from
GitPython code in any situations, nor how many items any iterators
yield.
  • Loading branch information
EliahKagan committed Dec 22, 2023
1 parent f5dc1c4 commit c3c008c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion git/objects/submodule/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,7 @@ def iter_items(
pc = repo.commit(parent_commit) # Parent commit instance
parser = cls._config_parser(repo, pc, read_only=True)
except (IOError, BadName):
return iter([])
return
# END handle empty iterator

for sms in parser.sections():
Expand Down

0 comments on commit c3c008c

Please sign in to comment.