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

rhymes at codespeak.net rhymes at codespeak.net
Sat Aug 12 18:31:59 CEST 2006


Author: rhymes
Date: Sat Aug 12 18:31:57 2006
New Revision: 31274

Modified:
   pypy/dist/pypy/module/bz2/fileobject.py
   pypy/dist/pypy/module/bz2/interp_bz2.py
Log:
more fixes to please the ext. compiler

Modified: pypy/dist/pypy/module/bz2/fileobject.py
==============================================================================
--- pypy/dist/pypy/module/bz2/fileobject.py	(original)
+++ pypy/dist/pypy/module/bz2/fileobject.py	Sat Aug 12 18:31:57 2006
@@ -111,6 +111,7 @@
 assert alignment(__sbuf) == 4, alignment(__sbuf)
 class __sFILEX(Structure):
     pass
+__sFILEX._fields_ = []
 class __sFILE(Structure):
     pass
 __sFILE._pack_ = 4
@@ -846,10 +847,13 @@
 allocfunc = CFUNCTYPE(POINTER(PyObject), POINTER(_typeobject), c_long)
 class PyMethodDef(Structure):
     pass
+PyMethodDef._fields_ = []
 class PyMemberDef(Structure):
     pass
+PyMemberDef._fields_ = []
 class PyGetSetDef(Structure):
     pass
+PyGetSetDef._fields_ = []
 _typeobject._fields_ = [
     ('ob_refcnt', Py_ssize_t),
     ('ob_type', POINTER(_typeobject)),

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	Sat Aug 12 18:31:57 2006
@@ -250,7 +250,7 @@
     skipnextlf = obj.f_skipnextlf
     univ_newline = obj.f_univ_newline
     
-    total_v_size = (100, size)[size > 0] # total no. of slots in buffer
+    total_v_size = [100, size][size > 0] # total no. of slots in buffer
     buf_lst = []
     buf_pos = 0
     
@@ -392,7 +392,7 @@
         
         if mode_char == "":
             mode_char = 'r'
-        mode = ('wb', 'rb')[mode_char == 'r']
+        mode = ['wb', 'rb'][mode_char == 'r']
         self.mode_string = mode
         
         # open the file and set the buffer
@@ -409,7 +409,7 @@
         bzerror = c_int()
         if mode_char == 'r':
             self.fp = libbz2.BZ2_bzReadOpen(byref(bzerror), self._file,
-                0, 0, None, 0)
+                0, 0, c_void_p(), 0)
         else:
             self.fp = libbz2.BZ2_bzWriteOpen(byref(bzerror), self._file,
                 compresslevel, 0, 0)
@@ -417,7 +417,7 @@
         if bzerror.value != BZ_OK:
             _catch_bz2_error(self.space, bzerror.value)
         
-        self.mode = (MODE_WRITE, MODE_READ)[mode_char == 'r']
+        self.mode = [MODE_WRITE, MODE_READ][mode_char == 'r']
     
     def __del__(self):
         bzerror = c_int()
@@ -591,7 +591,7 @@
         if size == 0:
             return self.space.wrap("")
         else:
-            size = (size, 0)[size < 0]
+            size = [size, 0][size < 0]
             return self.space.wrap(_getline(self.space, self, size))
     readline.unwrap_spec = ['self', int]
     
@@ -609,7 +609,7 @@
             raise OperationError(self.space.w_IOError,
                 self.space.wrap("file is not ready for reading"))
         
-        bufsize = (size, _new_buffer_size(0))[size < 0]
+        bufsize = [size, _new_buffer_size(0)][size < 0]
         
         if bufsize > MAXINT:
             raise OperationError(self.space.w_OverflowError,
@@ -818,9 +818,9 @@
         in_buf = create_string_buffer(in_bufsize)
         in_buf.value = data
         
-        self.bzs.next_in = in_buf
+        self.bzs.next_in = cast(in_buf, POINTER(c_char))
         self.bzs.avail_in = in_bufsize
-        self.bzs.next_out = out_buf
+        self.bzs.next_out = cast(out_buf, POINTER(c_char))
         self.bzs.avail_out = out_bufsize
         
         temp = []
@@ -838,7 +838,7 @@
                 
                 out_bufsize = _new_buffer_size(out_bufsize)
                 out_buf = create_string_buffer(out_bufsize)
-                self.bzs.next_out = out_buf
+                self.bzs.next_out = cast(out_buf, POINTER(c_char))
                 self.bzs.avail_out = out_bufsize
 
         if temp:
@@ -861,7 +861,7 @@
         out_bufsize = SMALLCHUNK
         out_buf = create_string_buffer(out_bufsize)
     
-        self.bzs.next_out = out_buf
+        self.bzs.next_out = cast(out_buf, POINTER(c_char))
         self.bzs.avail_out = out_bufsize
         
         total_out = _bzs_total_out(self.bzs)
@@ -880,7 +880,7 @@
                 
                 out_bufsize = _new_buffer_size(out_bufsize)
                 out_buf = create_string_buffer(out_bufsize)
-                self.bzs.next_out = out_buf
+                self.bzs.next_out = cast(out_buf, POINTER(c_char))
                 self.bzs.avail_out = out_bufsize
         
         if temp:
@@ -944,9 +944,9 @@
         out_bufsize = SMALLCHUNK
         out_buf = create_string_buffer(out_bufsize)
         
-        self.bzs.next_in = in_buf
+        self.bzs.next_in = cast(in_buf, POINTER(c_char))
         self.bzs.avail_in = in_bufsize
-        self.bzs.next_out = out_buf
+        self.bzs.next_out = cast(out_buf, POINTER(c_char))
         self.bzs.avail_out = out_bufsize
         
         temp = []
@@ -970,7 +970,7 @@
                 
                 out_bufsize = _new_buffer_size(out_bufsize)
                 out_buf = create_string_buffer(out_bufsize)
-                self.bzs.next_out = out_buf
+                self.bzs.next_out = cast(out_buf, POINTER(c_char))
                 self.bzs.avail_out = out_bufsize
                 
         if temp:
@@ -1014,9 +1014,9 @@
     in_buf = create_string_buffer(in_bufsize)
     in_buf.value = data
     
-    bzs.next_in = in_buf
+    bzs.next_in = cast(in_buf, POINTER(c_char))
     bzs.avail_in = in_bufsize
-    bzs.next_out = out_buf
+    bzs.next_out = cast(out_buf, POINTER(c_char))
     bzs.avail_out = out_bufsize
 
     bzerror = libbz2.BZ2_bzCompressInit(byref(bzs), compresslevel, 0, 0)
@@ -1039,7 +1039,7 @@
             
             out_bufsize = _new_buffer_size(out_bufsize)
             out_buf = create_string_buffer(out_bufsize)
-            bzs.next_out = out_buf
+            bzs.next_out = cast(out_buf, POINTER(c_char))
             bzs.avail_out = out_bufsize
     
     if temp:
@@ -1074,9 +1074,9 @@
     out_bufsize = SMALLCHUNK
     out_buf = create_string_buffer(out_bufsize)
     
-    bzs.next_in = in_buf
+    bzs.next_in = cast(in_buf, POINTER(c_char))
     bzs.avail_in = in_bufsize
-    bzs.next_out = out_buf
+    bzs.next_out = cast(out_buf, POINTER(c_char))
     bzs.avail_out = out_bufsize
     
     bzerror = libbz2.BZ2_bzDecompressInit(byref(bzs), 0, 0)
@@ -1103,7 +1103,7 @@
             
             out_bufsize = _new_buffer_size(out_bufsize)
             out_buf = create_string_buffer(out_bufsize)
-            bzs.next_out = out_buf
+            bzs.next_out = cast(out_buf, POINTER(c_char))
             bzs.avail_out = out_bufsize
     
     total_out = _bzs_total_out(bzs)



More information about the Pypy-commit mailing list