[pypy-commit] pypy release-2.3.x: merge default into branch

mattip noreply at buildbot.pypy.org
Mon Apr 21 20:28:35 CEST 2014


Author: Matti Picus <matti.picus at gmail.com>
Branch: release-2.3.x
Changeset: r70825:2e69f5fd041f
Date: 2014-04-21 21:26 +0300
http://bitbucket.org/pypy/pypy/changeset/2e69f5fd041f/

Log:	merge default into branch

diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -146,3 +146,6 @@
 
 .. branch: numpy-searchsorted
 Implement searchsorted without sorter kwarg
+
+.. branch: openbsd-lib-prefix
+add 'lib' prefix to link libraries on OpenBSD
diff --git a/pypy/module/micronumpy/app_numpy.py b/pypy/module/micronumpy/app_numpy.py
--- a/pypy/module/micronumpy/app_numpy.py
+++ b/pypy/module/micronumpy/app_numpy.py
@@ -22,4 +22,3 @@
         arr[j] = i
         i += step
     return arr
-
diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py
--- a/pypy/module/micronumpy/ndarray.py
+++ b/pypy/module/micronumpy/ndarray.py
@@ -677,23 +677,23 @@
     def descr_round(self, space, decimals=0, w_out=None):
         if space.is_none(w_out):
             if self.get_dtype().is_bool():
-                #numpy promotes bool.round() to float16. Go figure.
+                # numpy promotes bool.round() to float16. Go figure.
                 w_out = W_NDimArray.from_shape(space, self.get_shape(),
-                       descriptor.get_dtype_cache(space).w_float16dtype)
+                    descriptor.get_dtype_cache(space).w_float16dtype)
             else:
                 w_out = None
         elif not isinstance(w_out, W_NDimArray):
             raise OperationError(space.w_TypeError, space.wrap(
                 "return arrays must be of ArrayType"))
         out = descriptor.dtype_agreement(space, [self], self.get_shape(),
-                                           w_out)
+                                         w_out)
         if out.get_dtype().is_bool() and self.get_dtype().is_bool():
             calc_dtype = descriptor.get_dtype_cache(space).w_longdtype
         else:
             calc_dtype = out.get_dtype()
 
         if decimals == 0:
-            out = out.descr_view(space,space.type(self))
+            out = out.descr_view(space, space.type(self))
         loop.round(space, self, calc_dtype, self.get_shape(), decimals, out)
         return out
 
@@ -711,16 +711,16 @@
             side = 'r'
         else:
             raise oefmt(space.w_ValueError,
-                         "'%s' is an invalid value for keyword 'side'", side)
+                        "'%s' is an invalid value for keyword 'side'", side)
         if len(self.get_shape()) > 1:
             raise OperationError(space.w_ValueError, space.wrap(
-                        "a must be a 1-d array"))
+                "a must be a 1-d array")
         v = convert_to_array(space, w_v)
-        if len(v.get_shape()) >1:
+        if len(v.get_shape()) > 1:
             raise OperationError(space.w_ValueError, space.wrap(
-                        "v must be a 1-d array-like"))
-        ret = W_NDimArray.from_shape(space, v.get_shape(),
-                       descriptor.get_dtype_cache(space).w_longdtype)
+                 "v must be a 1-d array-like")
+        ret = W_NDimArray.from_shape(
+            space, v.get_shape(), descriptor.get_dtype_cache(space).w_longdtype)
         app_searchsort(space, self, v, space.wrap(side), ret)
         return ret
 
@@ -1277,35 +1277,26 @@
 
 app_searchsort = applevel(r"""
     def searchsort(arr, v, side, result):
-        def left_find_index(a, val):
+        import operator
+        def func(a, op, val):
             imin = 0
             imax = a.size
             while imin < imax:
                 imid = imin + ((imax - imin) >> 1)
-                if a[imid] < val:
-                    imin = imid +1
-                else:
-                    imax = imid
-            return imin
-        def right_find_index(a, val):
-            imin = 0
-            imax = a.size
-            while imin < imax:
-                imid = imin + ((imax - imin) >> 1)
-                if a[imid] <= val:
+                if op(a[imid], val):
                     imin = imid +1
                 else:
                     imax = imid
             return imin
         if side == 'l':
-            func = left_find_index
+            op = operator.lt
         else:
-            func = right_find_index
+            op = operator.le
         if v.size < 2:
-            result[...] = func(arr, v)
+            result[...] = func(arr, op, v)
         else:
             for i in range(v.size):
-                result[i] = func(arr, v[i])
+                result[i] = func(arr, op, v[i])
         return result
 """, filename=__file__).interphook('searchsort')
 
diff --git a/pypy/module/micronumpy/test/test_sorting.py b/pypy/module/micronumpy/test/test_sorting.py
--- a/pypy/module/micronumpy/test/test_sorting.py
+++ b/pypy/module/micronumpy/test/test_sorting.py
@@ -362,4 +362,3 @@
         assert (ret == [0, 5, 1, 2]).all()
         if '__pypy__' in sys.builtin_module_names:
             raises(NotImplementedError, "a.searchsorted(3, sorter=range(6))")
-
diff --git a/rpython/translator/platform/bsd.py b/rpython/translator/platform/bsd.py
--- a/rpython/translator/platform/bsd.py
+++ b/rpython/translator/platform/bsd.py
@@ -6,6 +6,7 @@
     DEFAULT_CC = 'clang'
 
     so_ext = 'so'
+    so_prefixes = ('lib', '')
     make_cmd = 'gmake'
 
     standalone_only = []


More information about the pypy-commit mailing list