Skip to content

Commit

Permalink
raise StopIteration needed in __next__
Browse files Browse the repository at this point in the history
  • Loading branch information
mdipierro committed Feb 24, 2019
1 parent 6e6c0c5 commit 48adca6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pydal/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -3094,7 +3094,7 @@ def __init__(self, db, sql, fields, colnames, blob_decode, cacheable):
def __next__(self):
db_row = self.cursor.fetchone()
if db_row is None:
return
raise StopIteration
row = self.db._adapter._parse(db_row, self.tmps, self.fields,
self.colnames, self.blob_decode,
self.cacheable, self.fields_virtual,
Expand All @@ -3121,6 +3121,7 @@ def __iter__(self):
except StopIteration:
# Iterator is over, adjust the cursor logic
self.db._adapter.close_cursor(self.cursor)
return
return

def first(self):
Expand Down

0 comments on commit 48adca6

Please sign in to comment.