Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5
Changeset: r88328:8cb801603f8a
Date: 2016-11-12 09:19 +0100
http://bitbucket.org/pypy/pypy/changeset/8cb801603f8a/

Log:    hg merge default

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -33,3 +33,4 @@
 050d84dd78997f021acf0e133934275d63547cc0 release-pypy2.7-v5.4.1
 050d84dd78997f021acf0e133934275d63547cc0 release-pypy2.7-v5.4.1
 0e2d9a73f5a1818d0245d75daccdbe21b2d5c3ef release-pypy2.7-v5.4.1
+aff251e543859ce4508159dd9f1a82a2f553de00 release-pypy2.7-v5.6.0
diff --git a/lib_pypy/cffi/_embedding.h b/lib_pypy/cffi/_embedding.h
--- a/lib_pypy/cffi/_embedding.h
+++ b/lib_pypy/cffi/_embedding.h
@@ -358,7 +358,7 @@
 
 /**********  PyPy-specific section  **********/
 
-void _CFFI_PYTHON_STARTUP_FUNC(const void *[]);   /* forward */
+PyMODINIT_FUNC _CFFI_PYTHON_STARTUP_FUNC(const void *[]);   /* forward */
 
 static struct _cffi_pypy_init_s {
     const char *name;
@@ -366,7 +366,7 @@
     const char *code;
 } _cffi_pypy_init = {
     _CFFI_MODULE_NAME,
-    _CFFI_PYTHON_STARTUP_FUNC,
+    (void(*)(const void *[]))_CFFI_PYTHON_STARTUP_FUNC,
     _CFFI_PYTHON_STARTUP_CODE,
 };
 
diff --git a/lib_pypy/cffi/recompiler.py b/lib_pypy/cffi/recompiler.py
--- a/lib_pypy/cffi/recompiler.py
+++ b/lib_pypy/cffi/recompiler.py
@@ -392,7 +392,7 @@
         #
         # the init function
         prnt('#ifdef PYPY_VERSION')
-        prnt('void')
+        prnt('PyMODINIT_FUNC')
         prnt('_cffi_pypyinit_%s(const void *p[])' % (base_module_name,))
         prnt('{')
         if self._num_externpy:
diff --git a/pypy/doc/faq.rst b/pypy/doc/faq.rst
--- a/pypy/doc/faq.rst
+++ b/pypy/doc/faq.rst
@@ -407,3 +407,18 @@
 long and gnarly. On the other hand, all our infrastructure (buildbots,
 benchmarking, etc) would have to be adapted. So unless somebody steps up and
 volunteers to do all that work, it will likely not happen.
+
+
+What is needed for Windows 64 support of PyPy?
+-----------------------------------------------
+
+First, please note that the Windows 32 PyPy binary works just fine on Windows
+64. The only problem is that it only supports up to 4GB of heap per process.
+
+As to real Windows 64 support: Currently we don't have an active PyPy developer
+whose main development platform is Windows. So if you are interested in getting
+Windows 64 support, we encourage you to volunteer `to make it happen`_! Another
+option would be to pay some PyPy developers to implement Windows 64 support,
+but so far there doesn't seem to be an overwhelming commercial interest in it.
+
+.. _`to make it happen`: 
windows.html#what-is-missing-for-a-full-64-bit-translation
diff --git a/pypy/doc/release-pypy2.7-v5.6.0.rst 
b/pypy/doc/release-pypy2.7-v5.6.0.rst
--- a/pypy/doc/release-pypy2.7-v5.6.0.rst
+++ b/pypy/doc/release-pypy2.7-v5.6.0.rst
@@ -11,7 +11,10 @@
 
 Work proceeds at a good pace on the PyPy3.5
 version due to a grant_ from the Mozilla Foundation, and some of those
-changes have been backported to PyPy2.7 where relevant
+changes have been backported to PyPy2.7 where relevant.
+
+The PowerPC and s390x backend have been enhanced_ with the capability use SIMD 
instructions
+ for micronumpy loops.
 
 We changed ``timeit`` to now report average +- standard deviation, which is
 better than the misleading minimum value reported in CPython.
@@ -45,6 +48,7 @@
 .. _`RPython`: https://rpython.readthedocs.org
 .. _`modules`: 
http://doc.pypy.org/en/latest/project-ideas.html#make-more-python-modules-pypy-friendly
 .. _`help`: http://doc.pypy.org/en/latest/project-ideas.html
+.. _`enhanced`: 
https://morepypy.blogspot.co.at/2016/11/vectorization-extended-powerpc-and-s390x.html
 
 What is PyPy?
 =============
diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -260,7 +260,8 @@
                 raise Exception("Cannot use the --output option with PyPy "
                                 "when --shared is on (it is by default). "
                                 "See issue #1971.")
-            if config.translation.profopt is not None:
+            if (config.translation.profopt is not None
+                    and not config.translation.noprofopt):
                 raise Exception("Cannot use the --profopt option "
                                 "when --shared is on (it is by default). "
                                 "See issue #2398.")
diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py
--- a/pypy/interpreter/error.py
+++ b/pypy/interpreter/error.py
@@ -638,20 +638,6 @@
     w_exc = new_import_error(space, w_msg, w_name, w_path)
     raise OperationError(space.w_ImportError, w_exc)
 
-def _convert_unexpected_exception_extra(space, e):
-    "NOT_RPYTHON"
-    if e.__class__.__name__ in (
-        'Skipped',     # list of exception class names that are ok
-        ):             # to get during ==untranslated tests== only
-        raise
-    # include the RPython-level traceback
-    exc = sys.exc_info()
-    import traceback, cStringIO
-    f = cStringIO.StringIO()
-    print >> f, "\nTraceback (interpreter-level):"
-    traceback.print_tb(exc[2], file=f)
-    return f.getvalue()
-
 @jit.dont_look_inside
 def get_converted_unexpected_exception(space, e):
     """This is used in two places when we get an non-OperationError
@@ -689,7 +675,9 @@
             debug_print_traceback()
             extra = '; internal traceback was dumped to stderr'
         else:
-            extra = _convert_unexpected_exception_extra(space, e)
+            # when untranslated, we don't wrap into an app-level
+            # SystemError (this makes debugging tests harder)
+            raise
         return OperationError(space.w_SystemError, space.wrap(
             "unexpected internal exception (please report a bug): %r%s" %
             (e, extra)))
diff --git a/pypy/interpreter/test/test_gateway.py 
b/pypy/interpreter/test/test_gateway.py
--- a/pypy/interpreter/test/test_gateway.py
+++ b/pypy/interpreter/test/test_gateway.py
@@ -805,6 +805,8 @@
         assert space.unwrap(space.getattr(w_g, space.wrap('__doc__'))) == 'bar'
 
     def test_system_error(self):
+        py.test.skip("we don't wrap a random exception inside SystemError "
+                     "when untranslated, because it makes testing harder")
         class UnexpectedException(Exception):
             pass
         space = self.space
@@ -820,6 +822,8 @@
                 'report a bug): UnexpectedException') in err
 
     def test_system_error_2(self):
+        py.test.skip("we don't wrap a random exception inside SystemError "
+                     "when untranslated, because it makes testing harder")
         class UnexpectedException(Exception):
             pass
         space = self.space
diff --git a/pypy/module/__pypy__/test/test_special.py 
b/pypy/module/__pypy__/test/test_special.py
--- a/pypy/module/__pypy__/test/test_special.py
+++ b/pypy/module/__pypy__/test/test_special.py
@@ -73,7 +73,6 @@
         from __pypy__ import do_what_I_mean
         x = do_what_I_mean()
         assert x == 42
-        raises(SystemError, do_what_I_mean, 1)
 
     def test_list_strategy(self):
         from __pypy__ import strategy
@@ -132,9 +131,19 @@
 class AppTestJitFeatures(object):
     spaceconfig = {"translation.jit": True}
 
+    def setup_class(cls):
+        cls.w_runappdirect = cls.space.wrap(cls.runappdirect)
+
     def test_jit_backend_features(self):
         from __pypy__ import jit_backend_features
         supported_types = jit_backend_features
         assert isinstance(supported_types, list)
         for x in supported_types:
             assert x in ['floats', 'singlefloats', 'longlong']
+
+    def test_do_what_I_mean_error(self):
+        if not self.runappdirect:
+            skip("we don't wrap a random exception inside SystemError "
+                 "when untranslated, because it makes testing harder")
+        from __pypy__ import do_what_I_mean
+        raises(SystemError, do_what_I_mean, 1)
diff --git a/pypy/module/pypyjit/test/conftest.py 
b/pypy/module/pypyjit/test/conftest.py
--- a/pypy/module/pypyjit/test/conftest.py
+++ b/pypy/module/pypyjit/test/conftest.py
@@ -1,5 +1,7 @@
 def pytest_addoption(parser):
     group = parser.getgroup("pypyjit options")
     group.addoption("--pypy", action="store", default=None, dest="pypy_c",
-                    help="the location of the JIT enabled pypy-c")
-
+                    help="DEPRECATED: use this in test_pypy_c instead")
+# XXX kill the corresponding section in the buildbot run,
+# which (as far as I can tell) ignores that option entirely and does
+# the same as the regular py.test.
diff --git a/pypy/tool/release/repackage.sh b/pypy/tool/release/repackage.sh
--- a/pypy/tool/release/repackage.sh
+++ b/pypy/tool/release/repackage.sh
@@ -1,8 +1,8 @@
 # Edit these appropriately before running this script
 maj=5
-min=4
-rev=1
-branchname=release-$maj.x  # ==OR== release-$maj.$min.x
+min=6
+rev=0
+branchname=release-pypy2.7-5.x # ==OR== release-$maj.x  # ==OR== 
release-$maj.$min.x
 tagname=release-pypy2.7-v$maj.$min.$rev  # ==OR== release-$maj.$min
 
 echo checking hg log -r $branchname
@@ -39,7 +39,7 @@
 zip -rq $rel-$plat.zip $rel-$plat
 rm -rf $rel-$plat
 
-# Do this after creating a tag, note the untarred directory is pypy-pypy-<hash>
+# Requires a valid $tagname, note the untarred directory is pypy-pypy-<hash>
 # so make sure there is not another one
 wget https://bitbucket.org/pypy/pypy/get/$tagname.tar.bz2
 tar -xf $tagname.tar.bz2
diff --git a/rpython/jit/backend/zarch/instructions.py 
b/rpython/jit/backend/zarch/instructions.py
--- a/rpython/jit/backend/zarch/instructions.py
+++ b/rpython/jit/backend/zarch/instructions.py
@@ -76,7 +76,6 @@
     'CLGRJ':   ('rie_b',  ['\xEC','\x65']),
     # compare and swap
     'CSG':     ('rsy_a', ['\xEB','\x30']),
-
 }
 
 logic_mnemonic_codes = {
@@ -340,7 +339,7 @@
     'VLVG':  ('vrs_b', ['\xE7','\x22']),
     'VLGV':  ('vrs_c', ['\xE7','\x21']),
 
-    # '': ('', ['','']),
+    'VSEG':  ('vrr_a', ['\xE7','\x5F'], 'v,v,m'),
 }
 
 all_mnemonic_codes.update(arith_mnemonic_codes)
diff --git a/rpython/jit/backend/zarch/vector_ext.py 
b/rpython/jit/backend/zarch/vector_ext.py
--- a/rpython/jit/backend/zarch/vector_ext.py
+++ b/rpython/jit/backend/zarch/vector_ext.py
@@ -139,6 +139,8 @@
             self.mc.VLVG(resloc, r.SCRATCH, l.addr(0), 
l.itemsize_to_mask(nsize))
             self.mc.VLGV(r.SCRATCH, loc0, l.addr(1), l.itemsize_to_mask(osize))
             self.mc.VLVG(resloc, r.SCRATCH, l.addr(1), 
l.itemsize_to_mask(nsize))
+            if nsize == 8:
+                self.mc.VSEG(resloc, resloc, l.itemsize_to_mask(osize))
 
     def emit_vec_float_abs(self, op, arglocs, regalloc):
         resloc, argloc, sizeloc = arglocs
diff --git a/rpython/jit/metainterp/optimizeopt/schedule.py 
b/rpython/jit/metainterp/optimizeopt/schedule.py
--- a/rpython/jit/metainterp/optimizeopt/schedule.py
+++ b/rpython/jit/metainterp/optimizeopt/schedule.py
@@ -14,6 +14,7 @@
 from rpython.jit.metainterp.jitexc import NotAVectorizeableLoop, 
NotAProfitableLoop
 from rpython.rtyper.lltypesystem.lloperation import llop
 from rpython.rtyper.lltypesystem import lltype
+from rpython.rlib.debug import debug_print
 
 
 def forwarded_vecinfo(op):
@@ -315,11 +316,8 @@
 
 def failnbail_transformation(msg):
     msg = '%s\n' % msg
-    if we_are_translated():
-        llop.debug_print(lltype.Void, msg)
-    else:
-        import pdb; pdb.set_trace()
-    raise NotImplementedError(msg)
+    debug_print(msg)
+    raise NotAVectorizeableLoop
 
 def turn_into_vector(state, pack):
     """ Turn a pack into a vector instruction """
diff --git a/rpython/jit/metainterp/test/test_vector.py 
b/rpython/jit/metainterp/test/test_vector.py
--- a/rpython/jit/metainterp/test/test_vector.py
+++ b/rpython/jit/metainterp/test/test_vector.py
@@ -860,6 +860,37 @@
         free_raw_storage(vb)
         free_raw_storage(vc)
 
+    def test_float_int32_casts(self):
+        myjitdriver = JitDriver(greens = [], reds = 'auto', vectorize=True)
+        def f(bytecount, va, vb, vc):
+            i = 0
+            j = 0
+            while j < bytecount:
+                myjitdriver.jit_merge_point()
+                a = raw_storage_getitem(rffi.DOUBLE,va,j)
+                b = raw_storage_getitem(rffi.INT,vb,i)
+                c = a+rffi.cast(rffi.DOUBLE,b)
+                raw_storage_setitem(vc, j, c)
+                i += 4
+                j += 8
+
+        count = 32
+        va = alloc_raw_storage(8*count, zero=True)
+        vb = alloc_raw_storage(4*count, zero=True)
+        for i,v in enumerate([1.0,2.0,3.0,4.0]*(count/4)):
+            raw_storage_setitem(va, i*8, rffi.cast(rffi.DOUBLE,v))
+        for i,v in enumerate([-1,-2,-3,-4]*(count/4)):
+            raw_storage_setitem(vb, i*4, rffi.cast(rffi.INT,v))
+        vc = alloc_raw_storage(8*count, zero=True)
+        self.meta_interp(f, [8*count, va, vb, vc], vec=True)
+
+        for i in range(count):
+            assert raw_storage_getitem(rffi.DOUBLE,vc,i*8) == 0.0
+
+        free_raw_storage(va)
+        free_raw_storage(vb)
+        free_raw_storage(vc)
+
 
 class TestLLtype(LLJitMixin, VectorizeTests):
     # skip some tests on this backend
diff --git a/rpython/rlib/rarithmetic.py b/rpython/rlib/rarithmetic.py
--- a/rpython/rlib/rarithmetic.py
+++ b/rpython/rlib/rarithmetic.py
@@ -323,93 +323,165 @@
 
     def __add__(self, other):
         x = long(self)
-        y = other      # may be a float
+        if not isinstance(other, (int, long)):
+            return x + other
+        y = long(other)
         return self._widen(other, x + y)
-    __radd__ = __add__
+
+    def __radd__(self, other):
+        x = long(self)
+        if not isinstance(other, (int, long)):
+            return other + x
+        y = long(other)
+        return self._widen(other, x + y)
 
     def __sub__(self, other):
         x = long(self)
-        y = other      # may be a float
+        if not isinstance(other, (int, long)):
+            return x - other
+        y = long(other)
         return self._widen(other, x - y)
 
     def __rsub__(self, other):
         y = long(self)
-        x = other      # may be a float
+        if not isinstance(other, (int, long)):
+            return other - y
+        x = long(other)
         return self._widen(other, x - y)
 
     def __mul__(self, other):
         x = long(self)
-        y = other      # may be a float
+        if not isinstance(other, (int, long)):
+            return x * other
+        y = long(other)
         return self._widen(other, x * y)
-    __rmul__ = __mul__
+
+    def __rmul__(self, other):
+        x = long(self)
+        if not isinstance(other, (int, long)):
+            return other * x
+        y = long(other)
+        return self._widen(other, x * y)
 
     def __div__(self, other):
         x = long(self)
-        y = other      # may be a float
-        return self._widen(other, x / y)
-
-    __floordiv__ = __div__
+        if not isinstance(other, (int, long)):
+            return x / other
+        y = long(other)
+        return self._widen(other, x // y)
 
     def __rdiv__(self, other):
         y = long(self)
-        x = other      # may be a float
-        return self._widen(other, x / y)
+        if not isinstance(other, (int, long)):
+            return other / y
+        x = long(other)
+        return self._widen(other, x // y)
 
-    __rfloordiv__ = __rdiv__
+    def __floordiv__(self, other):
+        x = long(self)
+        if not isinstance(other, (int, long)):
+            return x // other
+        y = long(other)
+        return self._widen(other, x // y)
+
+    def __rfloordiv__(self, other):
+        y = long(self)
+        if not isinstance(other, (int, long)):
+            return other // y
+        x = long(other)
+        return self._widen(other, x // y)
 
     def __mod__(self, other):
         x = long(self)
-        y = other      # not rpython if it is a float
+        if not isinstance(other, (int, long)):
+            return x % other
+        y = long(other)
         return self._widen(other, x % y)
 
     def __rmod__(self, other):
         y = long(self)
-        x = other      # not rpython if it is a float
+        if not isinstance(other, (int, long)):
+            return other % y
+        x = long(other)
         return self._widen(other, x % y)
 
     def __divmod__(self, other):
         x = long(self)
+        if not isinstance(other, (int, long)):
+            return divmod(x, other)
         y = long(other)
         res = divmod(x, y)
-        return (self.__class__(res[0]), self.__class__(res[1]))
+        return (self._widen(other, res[0]), self._widen(other, res[1]))
 
     def __lshift__(self, n):
         x = long(self)
+        if not isinstance(n, (int, long)):
+            raise TypeError
         y = long(n)
         return self.__class__(x << y)
 
     def __rlshift__(self, n):
         y = long(self)
+        if not isinstance(n, (int, long)):
+            raise TypeError
         x = long(n)
-        return self._widen(n, x << y)
+        return n.__class__(x << y)
 
     def __rshift__(self, n):
         x = long(self)
+        if not isinstance(n, (int, long)):
+            raise TypeError
         y = long(n)
-        return self._widen(n, x >> y)
+        return self.__class__(x >> y)
 
     def __rrshift__(self, n):
         y = long(self)
+        if not isinstance(n, (int, long)):
+            raise TypeError
         x = long(n)
-        return self._widen(n, x >> y)
+        return n.__class__(x >> y)
 
     def __or__(self, other):
         x = long(self)
+        if not isinstance(other, (int, long)):
+            return x | other
         y = long(other)
         return self._widen(other, x | y)
-    __ror__ = __or__
+
+    def __ror__(self, other):
+        x = long(self)
+        if not isinstance(other, (int, long)):
+            return other | x
+        y = long(other)
+        return self._widen(other, x | y)
 
     def __and__(self, other):
         x = long(self)
+        if not isinstance(other, (int, long)):
+            return x & other
         y = long(other)
         return self._widen(other, x & y)
-    __rand__ = __and__
+
+    def __rand__(self, other):
+        x = long(self)
+        if not isinstance(other, (int, long)):
+            return other & x
+        y = long(other)
+        return self._widen(other, x & y)
 
     def __xor__(self, other):
         x = long(self)
+        if not isinstance(other, (int, long)):
+            return x ^ other
         y = long(other)
         return self._widen(other, x ^ y)
-    __rxor__ = __xor__
+
+    def __rxor__(self, other):
+        x = long(self)
+        if not isinstance(other, (int, long)):
+            return other ^ x
+        y = long(other)
+        return self._widen(other, x ^ y)
 
     def __neg__(self):
         x = long(self)
@@ -428,12 +500,16 @@
 
     def __pow__(self, other, m=None):
         x = long(self)
+        if not isinstance(other, (int, long)):
+            return pow(x, other, m)
         y = long(other)
         res = pow(x, y, m)
         return self._widen(other, res)
 
     def __rpow__(self, other, m=None):
         y = long(self)
+        if not isinstance(other, (int, long)):
+            return pow(other, y, m)
         x = long(other)
         res = pow(x, y, m)
         return self._widen(other, res)
diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -655,7 +655,8 @@
     c_readdir = external('readdir', [DIRP], DIRENTP,
                          macro=True, save_err=rffi.RFFI_FULL_ERRNO_ZERO)
     c_closedir = external('closedir', [DIRP], rffi.INT, releasegil=False)
-    c_dirfd = external('dirfd', [DIRP], rffi.INT, releasegil=False)
+    c_dirfd = external('dirfd', [DIRP], rffi.INT, releasegil=False,
+                       macro=True)
     c_ioctl_voidp = external('ioctl', [rffi.INT, rffi.UINT, rffi.VOIDP], 
rffi.INT,
                          save_err=rffi.RFFI_SAVE_ERRNO)
 else:
diff --git a/rpython/rlib/test/test_rarithmetic.py 
b/rpython/rlib/test/test_rarithmetic.py
--- a/rpython/rlib/test/test_rarithmetic.py
+++ b/rpython/rlib/test/test_rarithmetic.py
@@ -603,11 +603,75 @@
         assert r_uint64(self._64_umax) + r_uint64(1) == r_uint64(0)
         assert r_uint64(0) - r_uint64(1) == r_uint64(self._64_umax)
 
-    def test_operation_with_float(self):
-        def f(x):
-            assert r_longlong(x) + 0.5 == 43.5
-            assert r_longlong(x) - 0.5 == 42.5
-            assert r_longlong(x) * 0.5 == 21.5
-            assert r_longlong(x) / 0.8 == 53.75
-        f(43)
-        interpret(f, [43])
+
+def test_operation_with_float():
+    def f(x):
+        assert r_longlong(x) + 0.5 == 43.5
+        assert r_longlong(x) - 0.5 == 42.5
+        assert r_longlong(x) * 0.5 == 21.5
+        assert r_longlong(x) / 0.8 == 53.75
+    f(43)
+    interpret(f, [43])
+
+def test_int64_plus_int32():
+    assert r_uint64(1234567891234) + r_uint32(1) == r_uint64(1234567891235)
+
+def test_fallback_paths():
+
+    def make(pattern):
+        def method(self, other, *extra):
+            if extra:
+                assert extra == (None,)   # for 'pow'
+            if type(other) is long:
+                return pattern % other
+            else:
+                return NotImplemented
+        return method
+
+    class A(object):
+        __add__  = make("a+%d")
+        __radd__ = make("%d+a")
+        __sub__  = make("a-%d")
+        __rsub__ = make("%d-a")
+        __mul__  = make("a*%d")
+        __rmul__ = make("%d*a")
+        __div__  = make("a/%d")
+        __rdiv__ = make("%d/a")
+        __floordiv__  = make("a//%d")
+        __rfloordiv__ = make("%d//a")
+        __mod__  = make("a%%%d")
+        __rmod__ = make("%d%%a")
+        __and__  = make("a&%d")
+        __rand__ = make("%d&a")
+        __or__   = make("a|%d")
+        __ror__  = make("%d|a")
+        __xor__  = make("a^%d")
+        __rxor__ = make("%d^a")
+        __pow__  = make("a**%d")
+        __rpow__ = make("%d**a")
+
+    a = A()
+    assert r_uint32(42) + a == "42+a"
+    assert a + r_uint32(42) == "a+42"
+    assert r_uint32(42) - a == "42-a"
+    assert a - r_uint32(42) == "a-42"
+    assert r_uint32(42) * a == "42*a"
+    assert a * r_uint32(42) == "a*42"
+    assert r_uint32(42) / a == "42/a"
+    assert a / r_uint32(42) == "a/42"
+    assert r_uint32(42) // a == "42//a"
+    assert a // r_uint32(42) == "a//42"
+    assert r_uint32(42) % a == "42%a"
+    assert a % r_uint32(42) == "a%42"
+    py.test.raises(TypeError, "a << r_uint32(42)")
+    py.test.raises(TypeError, "r_uint32(42) << a")
+    py.test.raises(TypeError, "a >> r_uint32(42)")
+    py.test.raises(TypeError, "r_uint32(42) >> a")
+    assert r_uint32(42) & a == "42&a"
+    assert a & r_uint32(42) == "a&42"
+    assert r_uint32(42) | a == "42|a"
+    assert a | r_uint32(42) == "a|42"
+    assert r_uint32(42) ^ a == "42^a"
+    assert a ^ r_uint32(42) == "a^42"
+    assert r_uint32(42) ** a == "42**a"
+    assert a ** r_uint32(42) == "a**42"
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to