Skip to content

Commit 48adca6

Browse files
committed
raise StopIteration needed in __next__
1 parent 6e6c0c5 commit 48adca6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pydal/objects.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3094,7 +3094,7 @@ def __init__(self, db, sql, fields, colnames, blob_decode, cacheable):
30943094
def __next__(self):
30953095
db_row = self.cursor.fetchone()
30963096
if db_row is None:
3097-
return
3097+
raise StopIteration
30983098
row = self.db._adapter._parse(db_row, self.tmps, self.fields,
30993099
self.colnames, self.blob_decode,
31003100
self.cacheable, self.fields_virtual,
@@ -3121,6 +3121,7 @@ def __iter__(self):
31213121
except StopIteration:
31223122
# Iterator is over, adjust the cursor logic
31233123
self.db._adapter.close_cursor(self.cursor)
3124+
return
31243125
return
31253126

31263127
def first(self):

0 commit comments

Comments
 (0)