[pypy-svn] pypy default: Every iterator should implement an __iter__ method

amauryfa commits-noreply at bitbucket.org
Wed Feb 9 15:54:06 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r41734:e8463de728da
Date: 2011-02-09 10:45 +0100
http://bitbucket.org/pypy/pypy/changeset/e8463de728da/

Log:	Every iterator should implement an __iter__ method "This is required
	to allow both containers and iterators to be used with the for and
	in statements"

diff --git a/lib-python/modified-2.7.0/sqlite3/test/dbapi.py b/lib-python/modified-2.7.0/sqlite3/test/dbapi.py
--- a/lib-python/modified-2.7.0/sqlite3/test/dbapi.py
+++ b/lib-python/modified-2.7.0/sqlite3/test/dbapi.py
@@ -1,4 +1,4 @@
-#-*- coding: ISO-8859-1 -*-
+#-*- coding: iso-8859-1 -*-
 # pysqlite2/test/dbapi.py: tests for DB-API compliance
 #
 # Copyright (C) 2004-2010 Gerhard H&#65533;ring <gh at ghaering.de>
@@ -332,6 +332,9 @@
             def __init__(self):
                 self.value = 5
 
+            def __iter__(self):
+                return self
+
             def next(self):
                 if self.value == 10:
                     raise StopIteration


More information about the Pypy-commit mailing list