[pypy-svn] r31371 - in pypy/dist/pypy/module/bz2: . test
rhymes at codespeak.net
rhymes at codespeak.net
Thu Aug 17 16:08:46 CEST 2006
Author: rhymes
Date: Thu Aug 17 16:08:44 2006
New Revision: 31371
Modified:
pypy/dist/pypy/module/bz2/interp_bz2.py
pypy/dist/pypy/module/bz2/test/test_bz2_file.py
Log:
use iter()
Modified: pypy/dist/pypy/module/bz2/interp_bz2.py
==============================================================================
--- pypy/dist/pypy/module/bz2/interp_bz2.py (original)
+++ pypy/dist/pypy/module/bz2/interp_bz2.py Thu Aug 17 16:08:44 2006
@@ -749,9 +749,8 @@
For backward compatibility. BZ2File objects now include the performance
optimizations previously implemented in the xreadlines module."""
-
- # this method should use the iterator protocol one day...
- return self.space.wrap(self)
+
+ return self.__iter__()
xreadlines.unwrap_spec = ['self']
Modified: pypy/dist/pypy/module/bz2/test/test_bz2_file.py
==============================================================================
--- pypy/dist/pypy/module/bz2/test/test_bz2_file.py (original)
+++ pypy/dist/pypy/module/bz2/test/test_bz2_file.py Thu Aug 17 16:08:44 2006
@@ -281,16 +281,15 @@
bz2f.close()
def test_iterator(self):
- # XXX: to fix when the actual iterator protocol will be available
from bz2 import BZ2File
from cStringIO import StringIO
self.create_temp_file()
bz2f = BZ2File("foo")
sio = StringIO(self.TEXT)
- assert list(bz2f.__iter__()) == sio.readlines()
+ assert list(iter(bz2f)) == sio.readlines()
bz2f.close()
-
+
def test_xreadlines(self):
from bz2 import BZ2File
from cStringIO import StringIO
More information about the Pypy-commit
mailing list