8000 Make Cursor an iterator · PyMySQL/PyMySQL@db640e4 · GitHub
[go: up one dir, main page]

Skip to content

Commit db640e4

Browse files
author
Gonzalo Sanchez
committed
Make Cursor an iterator
1 parent f0091e0 commit db640e4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pymysql/cursors.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,10 @@ def _do_get_result(self):
346346
self._rows = result.rows
347347

348348
def __iter__(self):
349-
return iter(self.fetchone, None)
349+
return self
350+
351+
def __next__(self):
352+
return next(iter(self.fetchone, None))
350353

351354
Warning = err.Warning
352355
Error = err.Error

0 commit comments

Comments
 (0)
0