Fixes #1641
There's no need to explicitly raise StopIteration as that's what a bare return statement does for a generator function - so yes they're the same. As of late 2014 return is correct and raise StopIteration for ending a generator is on a depreciation schedule. See PEP 479 for full details. https://stackoverflow.com/q/14183803/248296 https://www.python.org/dev/peps/pep-0479/
This commit is contained in:
parent
bf30aba005
commit
806a80cef1
@ -92,7 +92,7 @@ class QuerySet(BaseQuerySet):
|
|||||||
# Raise StopIteration if we already established there were no more
|
# Raise StopIteration if we already established there were no more
|
||||||
# docs in the db cursor.
|
# docs in the db cursor.
|
||||||
if not self._has_more:
|
if not self._has_more:
|
||||||
raise StopIteration
|
return
|
||||||
|
|
||||||
# Otherwise, populate more of the cache and repeat.
|
# Otherwise, populate more of the cache and repeat.
|
||||||
if len(self._result_cache) <= pos:
|
if len(self._result_cache) <= pos:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user