Skip to content

Commit 47a975f

Browse files
committed
Remove try/catch and directly use six.next
1 parent 63ac687 commit 47a975f

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/pip/_internal/utils/misc.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -545,13 +545,10 @@ def __init__(self, lines):
545545

546546
def readline(self):
547547
try:
548-
try:
549-
return next(self._gen)
550-
except NameError:
551-
# flake8-bugbear B305 suggests using six.next for
552-
# Python 2 compatibility. This along with the try/except
553-
# block can be removed once we drop Python 2 support
554-
return six.next(self._gen)
548+
# six.next allows for both Python 2 and 3 compatibility
549+
# It should be changed to next() builtin when we drop
550+
# python 2 support
551+
return six.next(self._gen)
555552
except StopIteration:
556553
return ''
557554

0 commit comments

Comments
 (0)