diff --git a/aiopg/extras.py b/aiopg/extras.py index db7fc51c..238e5178 100644 --- a/aiopg/extras.py +++ b/aiopg/extras.py @@ -7,15 +7,10 @@ def _paginate(seq, page_size): count = len(seq) it = iter(seq) for s in range(count + 1): - try: - for i in range(page_size): - page.append(next(it)) - yield page - page = [] - except StopIteration: - if page: - yield page - return + for i in range(page_size): + page.append(next(it)) + yield page + page = [] async def execute_batch(cur, sql, argslist, page_size=100):