Author: cito
Date: Sun Nov 22 09:16:50 2015
New Revision: 601

Log:
Python 3 changed the iterator protocol

Modified:
   trunk/module/pgdb.py

Modified: trunk/module/pgdb.py
==============================================================================
--- trunk/module/pgdb.py        Sun Nov 22 09:02:10 2015        (r600)
+++ trunk/module/pgdb.py        Sun Nov 22 09:16:50 2015        (r601)
@@ -405,13 +405,17 @@
         return [row_factory([typecast(*args)
             for args in zip(coltypes, row)]) for row in result]
 
-    def next(self):
+    def __next__(self):
         """Return the next row (support for the iteration protocol)."""
         res = self.fetchone()
         if res is None:
             raise StopIteration
         return res
 
+    # Note that since Python 2.6 the iterator protocol uses __next()__
+    # instead of next(), we keep it only for backward compatibility of pgdb.
+    next = __next__
+
     @staticmethod
     def nextset():
         """Not supported."""
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to