[pypy-svn] r36028 - pypy/dist/pypy/module/bz2

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Dec 28 19:24:33 CET 2006


Author: cfbolz
Date: Thu Dec 28 19:24:21 2006
New Revision: 36028

Modified:
   pypy/dist/pypy/module/bz2/interp_bz2.py
Log:
bz2 compiles with these small changes. Especially obvious is the removal 
of the NOT_RPYTHON line :-)


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 Dec 28 19:24:21 2006
@@ -228,6 +228,8 @@
 
     def read(self, n):
         # XXX not nice
+        if n <= 0:
+            return ''
         while not self.buffer:
             if self.finished:
                 return ""
@@ -237,6 +239,7 @@
                 if e.match(self.space, self.space.w_EOFError):
                     self.finished = True
                     return ""
+		raise
             self.buffer = self.space.str_w(w_read)
         if len(self.buffer) >= n:
             result = self.buffer[:n]
@@ -259,8 +262,6 @@
     """Standard I/O stream filter that compresses the stream with bz2."""
 
     def __init__(self, space, stream, compresslevel):
-        """NOT_RPYTHON"""
-        import bz2
         self.stream = stream
         self.space = space
         self.compressor = W_BZ2Compressor(space, compresslevel)



More information about the Pypy-commit mailing list