Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc49ba43

Browse files
michael-kByron
authored andcommitted
The proper way is return, not raise StopIteration
See PEP 479[1] which is part of Python 3.7[2].[1]:https://www.python.org/dev/peps/pep-0479/[2]:https://docs.python.org/3/whatsnew/3.7.html#changes-in-python-behavior
1 parent8fc6563 commitc49ba43

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

‎git/objects/submodule/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ def iter_items(cls, repo, parent_commit='HEAD'):
11601160
try:
11611161
parser=cls._config_parser(repo,pc,read_only=True)
11621162
exceptIOError:
1163-
raiseStopIteration
1163+
return
11641164
# END handle empty iterator
11651165

11661166
rt=pc.tree# root tree

‎git/repo/base.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,10 @@ def blame_incremental(self, rev, file, **kwargs):
714714

715715
stream= (lineforlineindata.split(b'\n')ifline)
716716
whileTrue:
717-
line=next(stream)# when exhausted, causes a StopIteration, terminating this function
717+
try:
718+
line=next(stream)# when exhausted, causes a StopIteration, terminating this function
719+
exceptStopIteration:
720+
return
718721
hexsha,orig_lineno,lineno,num_lines=line.split()
719722
lineno=int(lineno)
720723
num_lines=int(num_lines)
@@ -724,7 +727,10 @@ def blame_incremental(self, rev, file, **kwargs):
724727
# for this commit
725728
props= {}
726729
whileTrue:
727-
line=next(stream)
730+
try:
731+
line=next(stream)
732+
exceptStopIteration:
733+
return
728734
ifline==b'boundary':
729735
# "boundary" indicates a root commit and occurs
730736
# instead of the "previous" tag
@@ -749,7 +755,10 @@ def blame_incremental(self, rev, file, **kwargs):
749755
# Discard all lines until we find "filename" which is
750756
# guaranteed to be the last line
751757
whileTrue:
752-
line=next(stream)# will fail if we reach the EOF unexpectedly
758+
try:
759+
line=next(stream)# will fail if we reach the EOF unexpectedly
760+
exceptStopIteration:
761+
return
753762
tag,value=line.split(b' ',1)
754763
iftag==b'filename':
755764
orig_filename=value

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp