mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 17:34:08 +03:00
Merge branch 'fix-iter-warning'
This commit is contained in:
commit
8ac839ce95
|
@ -106,6 +106,7 @@ class DictCursorBase(_cursor):
|
|||
return res
|
||||
|
||||
def __iter__(self):
|
||||
try:
|
||||
if self._prefetch:
|
||||
res = super(DictCursorBase, self).__iter__()
|
||||
first = res.next()
|
||||
|
@ -118,6 +119,8 @@ class DictCursorBase(_cursor):
|
|||
yield first
|
||||
while 1:
|
||||
yield res.next()
|
||||
except StopIteration:
|
||||
return
|
||||
|
||||
|
||||
class DictConnection(_connection):
|
||||
|
@ -343,6 +346,7 @@ class NamedTupleCursor(_cursor):
|
|||
return map(nt._make, ts)
|
||||
|
||||
def __iter__(self):
|
||||
try:
|
||||
it = super(NamedTupleCursor, self).__iter__()
|
||||
t = it.next()
|
||||
|
||||
|
@ -354,6 +358,8 @@ class NamedTupleCursor(_cursor):
|
|||
|
||||
while 1:
|
||||
yield nt._make(it.next())
|
||||
except StopIteration:
|
||||
return
|
||||
|
||||
try:
|
||||
from collections import namedtuple
|
||||
|
|
Loading…
Reference in New Issue
Block a user