[pypy-svn] r31370 - pypy/dist/pypy/module/bz2
rhymes at codespeak.net
rhymes at codespeak.net
Thu Aug 17 16:06:02 CEST 2006
Author: rhymes
Date: Thu Aug 17 16:06:00 2006
New Revision: 31370
Modified:
pypy/dist/pypy/module/bz2/interp_bz2.py
Log:
fix some compilation issues
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:06:00 2006
@@ -117,7 +117,7 @@
libbz2.BZ2_bzWriteClose.argtypes = [POINTER(c_int), POINTER(BZFILE),
c_int, POINTER(c_uint), POINTER(c_uint)]
libbz2.BZ2_bzWriteClose.restype = c_void
-libbz2.BZ2_bzRead.argtypes = [POINTER(c_int), POINTER(BZFILE), c_char_p, c_int]
+libbz2.BZ2_bzRead.argtypes = [POINTER(c_int), POINTER(BZFILE), POINTER(c_char), c_int]
libbz2.BZ2_bzRead.restype = c_int
libbz2.BZ2_bzWrite.argtypes = [POINTER(c_int), POINTER(BZFILE), c_char_p, c_int]
libbz2.BZ2_bzWrite.restype = c_void
@@ -183,6 +183,8 @@
newlinetypes = obj.f_newlinetypes
skipnextlf = obj.f_skipnextlf
+ dst_lst = []
+ src_pos = dst_pos = 0
while n:
src = dst
@@ -191,9 +193,9 @@
shortread = n != 0 # True iff EOF or error
# needed to operate with "pointers"
- src_lst = list(src.value)
+ src_lst = [c for c in src.value]
src_pos = 0
- dst_lst = list(dst.value)
+ dst_lst = [c for c in dst.value]
dst_pos = 0
while nread:
nread -= 1
@@ -236,8 +238,8 @@
data = "".join(dst_lst)
buf = create_string_buffer(len(data))
- for i, ch in enumerate(data):
- buf[i] = ch
+ for i in range(len(data)):
+ buf[i] = data[i]
return dst_pos, buf
@@ -637,9 +639,12 @@
else:
break
- buf_lst = list(buf.value)
+ buf_lst = [c for c in buf.value]
if bytesread != bufsize:
- return self.space.wrap("".join(buf_lst[:bytesread]))
+ start = 0
+ assert bytesread >= 0
+ assert start >= 0
+ return self.space.wrap("".join(buf_lst[start:bytesread]))
return self.space.wrap("".join(buf_lst))
read.unwrap_spec = ['self', int]
@@ -703,7 +708,7 @@
# accessors for properties
def fget_newlines(space, self):
if self.f_newlinetypes == NEWLINE_UNKNOWN:
- return space.wrap(None)
+ return space.w_None
elif self.f_newlinetypes == NEWLINE_CR:
return space.wrap('\r')
elif self.f_newlinetypes == NEWLINE_LF:
More information about the Pypy-commit
mailing list