コード例 #1
0
 def test_bug(self):
     import _cffi_backend
     LONG = _cffi_backend.new_primitive_type('long')
     five = _cffi_backend.cast(LONG, 5)
     raises(TypeError, list, five)
     DOUBLE = _cffi_backend.new_primitive_type('double')
     five_and_a_half = _cffi_backend.cast(DOUBLE, 5.5)
     raises(TypeError, list, five_and_a_half)
コード例 #2
0
ファイル: test_fastpath.py プロジェクト: Darriall/pypy
 def test_bug(self):
     import _cffi_backend
     LONG = _cffi_backend.new_primitive_type('long')
     five = _cffi_backend.cast(LONG, 5)
     raises(TypeError, list, five)
     DOUBLE = _cffi_backend.new_primitive_type('double')
     five_and_a_half = _cffi_backend.cast(DOUBLE, 5.5)
     raises(TypeError, list, five_and_a_half)
コード例 #3
0
 def test_TypeError_if_no_length(self):
     import _cffi_backend
     LONG = _cffi_backend.new_primitive_type('long')
     P_LONG = _cffi_backend.new_pointer_type(LONG)
     LONG_ARRAY = _cffi_backend.new_array_type(P_LONG, 3)
     buf = _cffi_backend.newp(LONG_ARRAY)
     pbuf = _cffi_backend.cast(P_LONG, buf)
     raises(TypeError, "list(pbuf)")
コード例 #4
0
ファイル: test_fastpath.py プロジェクト: Darriall/pypy
 def test_TypeError_if_no_length(self):
     import _cffi_backend
     LONG = _cffi_backend.new_primitive_type('long')
     P_LONG = _cffi_backend.new_pointer_type(LONG)
     LONG_ARRAY = _cffi_backend.new_array_type(P_LONG, 3)
     buf = _cffi_backend.newp(LONG_ARRAY)
     pbuf = _cffi_backend.cast(P_LONG, buf)
     raises(TypeError, "list(pbuf)")
コード例 #5
0
        def main(libm_name):
            try:
                import _cffi_backend
            except ImportError:
                sys.stderr.write('SKIP: cannot import _cffi_backend\n')
                return 0

            libm = _cffi_backend.load_library(libm_name)
            BDouble = _cffi_backend.new_primitive_type("double")
            BInt = _cffi_backend.new_primitive_type("int")
            BPow = _cffi_backend.new_function_type([BDouble, BInt], BDouble)
            ldexp = libm.load_function(BPow, 'ldexp')
            i = 0
            res = 0
            while i < 300:
                tmp = ldexp(1, 3)  # ID: cfficall
                res += tmp
                i += 1
            BLong = _cffi_backend.new_primitive_type("long")
            ldexp_addr = int(_cffi_backend.cast(BLong, ldexp))
            return ldexp_addr, res
コード例 #6
0
ファイル: test_ffi.py プロジェクト: mozillazg/pypy
        def main(libm_name):
            try:
                import _cffi_backend
            except ImportError:
                sys.stderr.write('SKIP: cannot import _cffi_backend\n')
                return 0

            libm = _cffi_backend.load_library(libm_name)
            BDouble = _cffi_backend.new_primitive_type("double")
            BInt = _cffi_backend.new_primitive_type("int")
            BPow = _cffi_backend.new_function_type([BDouble, BInt], BDouble)
            ldexp = libm.load_function(BPow, 'ldexp')
            i = 0
            res = 0
            while i < 300:
                tmp = ldexp(1, 3)   # ID: cfficall
                res += tmp
                i += 1
            BLong = _cffi_backend.new_primitive_type("long")
            ldexp_addr = int(_cffi_backend.cast(BLong, ldexp))
            return ldexp_addr, res