[pypy-commit] pypy default: make dtype argument to itemtype.read() mandatory

rlamy noreply at buildbot.pypy.org
Sun Jun 7 06:08:10 CEST 2015


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: 
Changeset: r77935:5f4b0bd8073e
Date: 2015-06-07 04:32 +0100
http://bitbucket.org/pypy/pypy/changeset/5f4b0bd8073e/

Log:	make dtype argument to itemtype.read() mandatory

diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -210,7 +210,7 @@
             value = byteswap(value)
         raw_storage_setitem_unaligned(storage, i + offset, value)
 
-    def read(self, arr, i, offset, dtype=None):
+    def read(self, arr, i, offset, dtype):
         with arr as storage:
             return self.box(self._read(storage, i, offset))
 
@@ -1227,7 +1227,7 @@
             imag = byteswap(imag)
         return real, imag
 
-    def read(self, arr, i, offset, dtype=None):
+    def read(self, arr, i, offset, dtype):
         with arr as storage:
             real, imag = self._read(storage, i, offset)
             return self.box_complex(real, imag)
@@ -1795,7 +1795,7 @@
         self._write(arr.storage, i, offset, self.unbox(box),
                     arr.gcstruct)
 
-    def read(self, arr, i, offset, dtype=None):
+    def read(self, arr, i, offset, dtype):
         return self.box(self._read(arr.storage, i, offset))
 
     def byteswap(self, w_v):
@@ -2106,9 +2106,7 @@
             for k in range(size):
                 storage[k + offset + i] = box_storage[k + box.ofs]
 
-    def read(self, arr, i, offset, dtype=None):
-        if dtype is None:
-            dtype = arr.dtype
+    def read(self, arr, i, offset, dtype):
         return boxes.W_StringBox(arr, i + offset, dtype)
 
     def str_format(self, item, add_quotes=True):
@@ -2197,7 +2195,7 @@
         assert isinstance(box, boxes.W_UnicodeBox)
         raise oefmt(self.space.w_NotImplementedError, "unicode type not completed")
 
-    def read(self, arr, i, offset, dtype=None):
+    def read(self, arr, i, offset, dtype):
         raise oefmt(self.space.w_NotImplementedError, "unicode type not completed")
 
     def str_format(self, item, add_quotes=True):
@@ -2301,9 +2299,7 @@
                                     dtype.subdtype)
         return W_NDimArray(implementation)
 
-    def read(self, arr, i, offset, dtype=None):
-        if dtype is None:
-            dtype = arr.dtype
+    def read(self, arr, i, offset, dtype):
         return boxes.W_VoidBox(arr, i + offset, dtype)
 
     @jit.unroll_safe
@@ -2345,9 +2341,7 @@
     kind = NPY.VOIDLTR
     char = NPY.VOIDLTR
 
-    def read(self, arr, i, offset, dtype=None):
-        if dtype is None:
-            dtype = arr.dtype
+    def read(self, arr, i, offset, dtype):
         return boxes.W_VoidBox(arr, i + offset, dtype)
 
     @jit.unroll_safe


More information about the pypy-commit mailing list