Author: Alex Gaynor <[email protected]>
Branch: numpy-dtype-refactor
Changeset: r49328:2544cc59dc76
Date: 2011-11-11 11:26 -0500
http://bitbucket.org/pypy/pypy/changeset/2544cc59dc76/
Log: merged default in
diff --git a/lib-python/modified-2.7/test/test_import.py
b/lib-python/modified-2.7/test/test_import.py
--- a/lib-python/modified-2.7/test/test_import.py
+++ b/lib-python/modified-2.7/test/test_import.py
@@ -64,6 +64,7 @@
except ImportError, err:
self.fail("import from %s failed: %s" % (ext, err))
else:
+ # XXX importing .pyw is missing on Windows
self.assertEqual(mod.a, a,
"module loaded (%s) but contents invalid" % mod)
self.assertEqual(mod.b, b,
diff --git a/lib-python/modified-2.7/test/test_repr.py
b/lib-python/modified-2.7/test/test_repr.py
--- a/lib-python/modified-2.7/test/test_repr.py
+++ b/lib-python/modified-2.7/test/test_repr.py
@@ -254,8 +254,14 @@
eq = self.assertEqual
touch(os.path.join(self.subpkgname, self.pkgname + os.extsep + 'py'))
from
areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation
import areallylongpackageandmodulenametotestreprtruncation
- eq(repr(areallylongpackageandmodulenametotestreprtruncation),
- "<module '%s' from '%s'>" %
(areallylongpackageandmodulenametotestreprtruncation.__name__,
areallylongpackageandmodulenametotestreprtruncation.__file__))
+ # On PyPy, we use %r to format the file name; on CPython it is done
+ # with '%s'. It seems to me that %r is safer <arigo>.
+ if '__pypy__' in sys.builtin_module_names:
+ eq(repr(areallylongpackageandmodulenametotestreprtruncation),
+ "<module %r from %r>" %
(areallylongpackageandmodulenametotestreprtruncation.__name__,
areallylongpackageandmodulenametotestreprtruncation.__file__))
+ else:
+ eq(repr(areallylongpackageandmodulenametotestreprtruncation),
+ "<module '%s' from '%s'>" %
(areallylongpackageandmodulenametotestreprtruncation.__name__,
areallylongpackageandmodulenametotestreprtruncation.__file__))
eq(repr(sys), "<module 'sys' (built-in)>")
def test_type(self):
diff --git a/lib-python/2.7/test/test_subprocess.py
b/lib-python/modified-2.7/test/test_subprocess.py
copy from lib-python/2.7/test/test_subprocess.py
copy to lib-python/modified-2.7/test/test_subprocess.py
--- a/lib-python/2.7/test/test_subprocess.py
+++ b/lib-python/modified-2.7/test/test_subprocess.py
@@ -16,11 +16,11 @@
# Depends on the following external programs: Python
#
-if mswindows:
- SETBINARY = ('import msvcrt; msvcrt.setmode(sys.stdout.fileno(), '
- 'os.O_BINARY);')
-else:
- SETBINARY = ''
+#if mswindows:
+# SETBINARY = ('import msvcrt; msvcrt.setmode(sys.stdout.fileno(), '
+# 'os.O_BINARY);')
+#else:
+# SETBINARY = ''
try:
@@ -420,8 +420,9 @@
self.assertStderrEqual(stderr, "")
def test_universal_newlines(self):
- p = subprocess.Popen([sys.executable, "-c",
- 'import sys,os;' + SETBINARY +
+ # NB. replaced SETBINARY with the -u flag
+ p = subprocess.Popen([sys.executable, "-u", "-c",
+ 'import sys,os;' + #SETBINARY +
'sys.stdout.write("line1\\n");'
'sys.stdout.flush();'
'sys.stdout.write("line2\\r");'
@@ -448,8 +449,9 @@
def test_universal_newlines_communicate(self):
# universal newlines through communicate()
- p = subprocess.Popen([sys.executable, "-c",
- 'import sys,os;' + SETBINARY +
+ # NB. replaced SETBINARY with the -u flag
+ p = subprocess.Popen([sys.executable, "-u", "-c",
+ 'import sys,os;' + #SETBINARY +
'sys.stdout.write("line1\\n");'
'sys.stdout.flush();'
'sys.stdout.write("line2\\r");'
diff --git a/pypy/jit/backend/llsupport/descr.py
b/pypy/jit/backend/llsupport/descr.py
--- a/pypy/jit/backend/llsupport/descr.py
+++ b/pypy/jit/backend/llsupport/descr.py
@@ -355,6 +355,10 @@
return False # unless overridden
def create_call_stub(self, rtyper, RESULT):
+ from pypy.rlib.clibffi import FFI_DEFAULT_ABI
+ assert self.get_call_conv() == FFI_DEFAULT_ABI, (
+ "%r: create_call_stub() with a non-default call ABI" % (self,))
+
def process(c):
if c == 'L':
assert longlong.supports_longlong
diff --git a/pypy/jit/codewriter/call.py b/pypy/jit/codewriter/call.py
--- a/pypy/jit/codewriter/call.py
+++ b/pypy/jit/codewriter/call.py
@@ -212,7 +212,10 @@
elidable = False
loopinvariant = False
if op.opname == "direct_call":
- func = getattr(get_funcobj(op.args[0].value), '_callable', None)
+ funcobj = get_funcobj(op.args[0].value)
+ assert getattr(funcobj, 'calling_conv', 'c') == 'c', (
+ "%r: getcalldescr() with a non-default call ABI" % (op,))
+ func = getattr(funcobj, '_callable', None)
elidable = getattr(func, "_elidable_function_", False)
loopinvariant = getattr(func, "_jit_loop_invariant_", False)
if loopinvariant:
diff --git a/pypy/module/_rawffi/structure.py b/pypy/module/_rawffi/structure.py
--- a/pypy/module/_rawffi/structure.py
+++ b/pypy/module/_rawffi/structure.py
@@ -212,6 +212,8 @@
while count + basic_size <= total_size:
fieldtypes.append(basic_ffi_type)
count += basic_size
+ if basic_size == 0: # corner case. get out of this infinite
+ break # loop after 1 iteration ("why not")
self.ffi_struct = clibffi.make_struct_ffitype_e(self.size,
self.alignment,
fieldtypes)
diff --git a/pypy/module/posix/__init__.py b/pypy/module/posix/__init__.py
--- a/pypy/module/posix/__init__.py
+++ b/pypy/module/posix/__init__.py
@@ -137,6 +137,8 @@
interpleveldefs['execve'] = 'interp_posix.execve'
if hasattr(posix, 'spawnv'):
interpleveldefs['spawnv'] = 'interp_posix.spawnv'
+ if hasattr(posix, 'spawnve'):
+ interpleveldefs['spawnve'] = 'interp_posix.spawnve'
if hasattr(os, 'uname'):
interpleveldefs['uname'] = 'interp_posix.uname'
if hasattr(os, 'sysconf'):
diff --git a/pypy/module/posix/interp_posix.py
b/pypy/module/posix/interp_posix.py
--- a/pypy/module/posix/interp_posix.py
+++ b/pypy/module/posix/interp_posix.py
@@ -760,6 +760,14 @@
except OSError, e:
raise wrap_oserror(space, e)
+def _env2interp(space, w_env):
+ env = {}
+ w_keys = space.call_method(w_env, 'keys')
+ for w_key in space.unpackiterable(w_keys):
+ w_value = space.getitem(w_env, w_key)
+ env[space.str_w(w_key)] = space.str_w(w_value)
+ return env
+
def execve(space, w_command, w_args, w_env):
""" execve(path, args, env)
@@ -771,11 +779,7 @@
"""
command = fsencode_w(space, w_command)
args = [fsencode_w(space, w_arg) for w_arg in space.unpackiterable(w_args)]
- env = {}
- w_keys = space.call_method(w_env, 'keys')
- for w_key in space.unpackiterable(w_keys):
- w_value = space.getitem(w_env, w_key)
- env[space.str_w(w_key)] = space.str_w(w_value)
+ env = _env2interp(space, w_env)
try:
os.execve(command, args, env)
except OSError, e:
@@ -790,6 +794,16 @@
raise wrap_oserror(space, e)
return space.wrap(ret)
+@unwrap_spec(mode=int, path=str)
+def spawnve(space, mode, path, w_args, w_env):
+ args = [space.str_w(w_arg) for w_arg in space.unpackiterable(w_args)]
+ env = _env2interp(space, w_env)
+ try:
+ ret = os.spawnve(mode, path, args, env)
+ except OSError, e:
+ raise wrap_oserror(space, e)
+ return space.wrap(ret)
+
def utime(space, w_path, w_tuple):
""" utime(path, (atime, mtime))
utime(path, None)
diff --git a/pypy/module/posix/test/test_posix2.py
b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -471,6 +471,17 @@
['python', '-c', 'raise(SystemExit(42))'])
assert ret == 42
+ if hasattr(__import__(os.name), "spawnve"):
+ def test_spawnve(self):
+ os = self.posix
+ import sys
+ print self.python
+ ret = os.spawnve(os.P_WAIT, self.python,
+ ['python', '-c',
+
"raise(SystemExit(int(__import__('os').environ['FOOBAR'])))"],
+ {'FOOBAR': '42'})
+ assert ret == 42
+
def test_popen(self):
os = self.posix
for i in range(5):
diff --git a/pypy/module/select/test/test_select.py
b/pypy/module/select/test/test_select.py
--- a/pypy/module/select/test/test_select.py
+++ b/pypy/module/select/test/test_select.py
@@ -214,11 +214,15 @@
def test_poll(self):
import select
- class A(object):
- def __int__(self):
- return 3
-
- select.poll().poll(A()) # assert did not crash
+ readend, writeend = self.getpair()
+ try:
+ class A(object):
+ def __int__(self):
+ return readend.fileno()
+ select.poll().poll(A()) # assert did not crash
+ finally:
+ readend.close()
+ writeend.close()
class AppTestSelectWithPipes(_AppTestSelect):
"Use a pipe to get pairs of file descriptors"
diff --git a/pypy/module/signal/__init__.py b/pypy/module/signal/__init__.py
--- a/pypy/module/signal/__init__.py
+++ b/pypy/module/signal/__init__.py
@@ -20,7 +20,7 @@
interpleveldefs['pause'] = 'interp_signal.pause'
interpleveldefs['siginterrupt'] = 'interp_signal.siginterrupt'
- if hasattr(cpy_signal, 'setitimer'):
+ if os.name == 'posix':
interpleveldefs['setitimer'] = 'interp_signal.setitimer'
interpleveldefs['getitimer'] = 'interp_signal.getitimer'
for name in ['ITIMER_REAL', 'ITIMER_VIRTUAL', 'ITIMER_PROF']:
diff --git a/pypy/module/signal/test/test_signal.py
b/pypy/module/signal/test/test_signal.py
--- a/pypy/module/signal/test/test_signal.py
+++ b/pypy/module/signal/test/test_signal.py
@@ -1,4 +1,4 @@
-import os, py
+import os, py, sys
import signal as cpy_signal
from pypy.conftest import gettestobjspace
@@ -264,6 +264,10 @@
class AppTestItimer:
spaceconfig = dict(usemodules=['signal'])
+ def setup_class(cls):
+ if sys.platform == 'win32':
+ py.test.skip("Unix only")
+
def test_itimer_real(self):
import signal
diff --git a/pypy/objspace/std/bytearrayobject.py
b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -282,15 +282,12 @@
def str__Bytearray(space, w_bytearray):
return space.wrap(''.join(w_bytearray.data))
-def _convert_idx_params(space, w_self, w_start, w_stop):
- length = len(w_self.data)
+def str_count__Bytearray_Int_ANY_ANY(space, w_bytearray, w_char, w_start,
w_stop):
+ char = w_char.intval
+ bytearray = w_bytearray.data
+ length = len(bytearray)
start, stop = slicetype.unwrap_start_stop(
space, length, w_start, w_stop, False)
- return start, stop, length
-
-def str_count__Bytearray_Int_ANY_ANY(space, w_bytearray, w_char, w_start,
w_stop):
- char = w_char.intval
- start, stop, length = _convert_idx_params(space, w_bytearray, w_start,
w_stop)
count = 0
for i in range(start, min(stop, length)):
c = w_bytearray.data[i]
diff --git a/pypy/objspace/std/test/test_bytes.py
b/pypy/objspace/std/test/test_bytearrayobject.py
rename from pypy/objspace/std/test/test_bytes.py
rename to pypy/objspace/std/test/test_bytearrayobject.py
diff --git a/pypy/rlib/clibffi.py b/pypy/rlib/clibffi.py
--- a/pypy/rlib/clibffi.py
+++ b/pypy/rlib/clibffi.py
@@ -30,6 +30,9 @@
_MAC_OS = platform.name == "darwin"
_FREEBSD_7 = platform.name == "freebsd7"
+_LITTLE_ENDIAN = sys.byteorder == 'little'
+_BIG_ENDIAN = sys.byteorder == 'big'
+
if _WIN32:
from pypy.rlib import rwin32
@@ -338,15 +341,38 @@
cast_type_to_ffitype._annspecialcase_ = 'specialize:memo'
def push_arg_as_ffiptr(ffitp, arg, ll_buf):
- # this is for primitive types. For structures and arrays
- # would be something different (more dynamic)
+ # This is for primitive types. Note that the exact type of 'arg' may be
+ # different from the expected 'c_size'. To cope with that, we fall back
+ # to a byte-by-byte copy.
TP = lltype.typeOf(arg)
TP_P = lltype.Ptr(rffi.CArray(TP))
- buf = rffi.cast(TP_P, ll_buf)
- buf[0] = arg
+ TP_size = rffi.sizeof(TP)
+ c_size = intmask(ffitp.c_size)
+ # if both types have the same size, we can directly write the
+ # value to the buffer
+ if c_size == TP_size:
+ buf = rffi.cast(TP_P, ll_buf)
+ buf[0] = arg
+ else:
+ # needs byte-by-byte copying. Make sure 'arg' is an integer type.
+ # Note that this won't work for rffi.FLOAT/rffi.DOUBLE.
+ assert TP is not rffi.FLOAT and TP is not rffi.DOUBLE
+ if TP_size <= rffi.sizeof(lltype.Signed):
+ arg = rffi.cast(lltype.Unsigned, arg)
+ else:
+ arg = rffi.cast(lltype.UnsignedLongLong, arg)
+ if _LITTLE_ENDIAN:
+ for i in range(c_size):
+ ll_buf[i] = chr(arg & 0xFF)
+ arg >>= 8
+ elif _BIG_ENDIAN:
+ for i in range(c_size-1, -1, -1):
+ ll_buf[i] = chr(arg & 0xFF)
+ arg >>= 8
+ else:
+ raise AssertionError
push_arg_as_ffiptr._annspecialcase_ = 'specialize:argtype(1)'
-
# type defs for callback and closure userdata
USERDATA_P = lltype.Ptr(lltype.ForwardReference())
CALLBACK_TP = lltype.Ptr(lltype.FuncType([rffi.VOIDPP, rffi.VOIDP, USERDATA_P],
diff --git a/pypy/rlib/libffi.py b/pypy/rlib/libffi.py
--- a/pypy/rlib/libffi.py
+++ b/pypy/rlib/libffi.py
@@ -234,7 +234,7 @@
# It is important that there is no other operation in the middle, else
# the optimizer will fail to recognize the pattern and won't turn it
# into a fast CALL. Note that "arg = arg.next" is optimized away,
- # assuming that archain is completely virtual.
+ # assuming that argchain is completely virtual.
self = jit.promote(self)
if argchain.numargs != len(self.argtypes):
raise TypeError, 'Wrong number of arguments: %d expected, got %d'
%\
diff --git a/pypy/rlib/test/test_libffi.py b/pypy/rlib/test/test_libffi.py
--- a/pypy/rlib/test/test_libffi.py
+++ b/pypy/rlib/test/test_libffi.py
@@ -179,6 +179,17 @@
res = self.call(func, [chr(20), 22], rffi.LONG)
assert res == 42
+ def test_char_args(self):
+ """
+ char sum_args(char a, char b) {
+ return a + b;
+ }
+ """
+ libfoo = self.get_libfoo()
+ func = (libfoo, 'sum_args', [types.schar, types.schar], types.schar)
+ res = self.call(func, [123, 43], rffi.CHAR)
+ assert res == chr(166)
+
def test_unsigned_short_args(self):
"""
unsigned short sum_xy_us(unsigned short x, unsigned short y)
diff --git a/pypy/rpython/lltypesystem/ll2ctypes.py
b/pypy/rpython/lltypesystem/ll2ctypes.py
--- a/pypy/rpython/lltypesystem/ll2ctypes.py
+++ b/pypy/rpython/lltypesystem/ll2ctypes.py
@@ -1166,7 +1166,9 @@
TYPE1 = lltype.typeOf(value)
cvalue = lltype2ctypes(value)
cresulttype = get_ctypes_type(RESTYPE)
- if isinstance(TYPE1, lltype.Ptr):
+ if RESTYPE == TYPE1:
+ return value
+ elif isinstance(TYPE1, lltype.Ptr):
if isinstance(RESTYPE, lltype.Ptr):
# shortcut: ptr->ptr cast
cptr = ctypes.cast(cvalue, cresulttype)
diff --git a/pypy/rpython/lltypesystem/rffi.py
b/pypy/rpython/lltypesystem/rffi.py
--- a/pypy/rpython/lltypesystem/rffi.py
+++ b/pypy/rpython/lltypesystem/rffi.py
@@ -125,6 +125,7 @@
canraise=False,
random_effects_on_gcobjs=
random_effects_on_gcobjs,
+ calling_conv=calling_conv,
**kwds)
if isinstance(_callable, ll2ctypes.LL2CtypesCallable):
_callable.funcptr = funcptr
@@ -245,8 +246,14 @@
wrapper._always_inline_ = True
# for debugging, stick ll func ptr to that
wrapper._ptr = funcptr
+ wrapper = func_with_new_name(wrapper, name)
- return func_with_new_name(wrapper, name)
+ if calling_conv != "c":
+ from pypy.rlib.jit import dont_look_inside
+ wrapper = dont_look_inside(wrapper)
+
+ return wrapper
+
class CallbackHolder:
def __init__(self):
@@ -855,11 +862,12 @@
try:
unsigned = not tp._type.SIGNED
except AttributeError:
- if tp in [lltype.Char, lltype.Float, lltype.Signed] or\
- isinstance(tp, lltype.Ptr):
+ if (not isinstance(tp, lltype.Primitive) or
+ tp in (FLOAT, DOUBLE) or
+ cast(lltype.SignedLongLong, cast(tp, -1)) < 0):
unsigned = False
else:
- unsigned = False
+ unsigned = True
return size, unsigned
def sizeof(tp):
diff --git a/pypy/rpython/lltypesystem/test/test_rffi.py
b/pypy/rpython/lltypesystem/test/test_rffi.py
--- a/pypy/rpython/lltypesystem/test/test_rffi.py
+++ b/pypy/rpython/lltypesystem/test/test_rffi.py
@@ -18,6 +18,7 @@
from pypy.conftest import option
from pypy.objspace.flow.model import summary
from pypy.translator.tool.cbuild import ExternalCompilationInfo
+from pypy.rlib.rarithmetic import r_singlefloat
class BaseTestRffi:
def test_basic(self):
@@ -704,6 +705,11 @@
res = cast(lltype.Signed, 42.5)
assert res == 42
+ res = cast(lltype.SingleFloat, 12.3)
+ assert res == r_singlefloat(12.3)
+ res = cast(lltype.SingleFloat, res)
+ assert res == r_singlefloat(12.3)
+
def test_rffi_sizeof(self):
try:
import ctypes
diff --git a/pypy/rpython/module/ll_os.py b/pypy/rpython/module/ll_os.py
--- a/pypy/rpython/module/ll_os.py
+++ b/pypy/rpython/module/ll_os.py
@@ -356,6 +356,32 @@
return extdef([int, str, [str]], int, llimpl=spawnv_llimpl,
export_name="ll_os.ll_os_spawnv")
+ @registering_if(os, 'spawnve')
+ def register_os_spawnve(self):
+ os_spawnve = self.llexternal('spawnve',
+ [rffi.INT, rffi.CCHARP, rffi.CCHARPP,
+ rffi.CCHARPP],
+ rffi.INT)
+
+ def spawnve_llimpl(mode, path, args, env):
+ envstrs = []
+ for item in env.iteritems():
+ envstrs.append("%s=%s" % item)
+
+ mode = rffi.cast(rffi.INT, mode)
+ l_args = rffi.liststr2charpp(args)
+ l_env = rffi.liststr2charpp(envstrs)
+ childpid = os_spawnve(mode, path, l_args, l_env)
+ rffi.free_charpp(l_env)
+ rffi.free_charpp(l_args)
+ if childpid == -1:
+ raise OSError(rposix.get_errno(), "os_spawnve failed")
+ return rffi.cast(lltype.Signed, childpid)
+
+ return extdef([int, str, [str], {str: str}], int,
+ llimpl=spawnve_llimpl,
+ export_name="ll_os.ll_os_spawnve")
+
@registering(os.dup)
def register_os_dup(self):
os_dup = self.llexternal(underscore_on_windows+'dup', [rffi.INT],
rffi.INT)
diff --git a/pypy/translator/c/test/test_extfunc.py
b/pypy/translator/c/test/test_extfunc.py
--- a/pypy/translator/c/test/test_extfunc.py
+++ b/pypy/translator/c/test/test_extfunc.py
@@ -818,6 +818,24 @@
func()
assert open(filename).read() == "2"
+if hasattr(posix, 'spawnve'):
+ def test_spawnve():
+ filename = str(udir.join('test_spawnve.txt'))
+ progname = str(sys.executable)
+ scriptpath = udir.join('test_spawnve.py')
+ scriptpath.write('import os\n' +
+ 'f=open(%r,"w")\n' % filename +
+ 'f.write(os.environ["FOOBAR"])\n' +
+ 'f.close\n')
+ scriptname = str(scriptpath)
+ def does_stuff():
+ l = [progname, scriptname]
+ pid = os.spawnve(os.P_NOWAIT, progname, l, {'FOOBAR': '42'})
+ os.waitpid(pid, 0)
+ func = compile(does_stuff, [])
+ func()
+ assert open(filename).read() == "42"
+
def test_utime():
path = str(udir.ensure("test_utime.txt"))
from time import time, sleep
diff --git a/pypy/translator/platform/__init__.py
b/pypy/translator/platform/__init__.py
--- a/pypy/translator/platform/__init__.py
+++ b/pypy/translator/platform/__init__.py
@@ -240,10 +240,13 @@
else:
host_factory = Linux64
elif sys.platform == 'darwin':
- from pypy.translator.platform.darwin import Darwin_i386, Darwin_x86_64
+ from pypy.translator.platform.darwin import Darwin_i386, Darwin_x86_64,
Darwin_PowerPC
import platform
- assert platform.machine() in ('i386', 'x86_64')
- if sys.maxint <= 2147483647:
+ assert platform.machine() in ('Power Macintosh', 'i386', 'x86_64')
+
+ if platform.machine() == 'Power Macintosh':
+ host_factory = Darwin_PowerPC
+ elif sys.maxint <= 2147483647:
host_factory = Darwin_i386
else:
host_factory = Darwin_x86_64
diff --git a/pypy/translator/platform/darwin.py
b/pypy/translator/platform/darwin.py
--- a/pypy/translator/platform/darwin.py
+++ b/pypy/translator/platform/darwin.py
@@ -71,6 +71,11 @@
link_flags = ('-arch', 'i386')
cflags = ('-arch', 'i386', '-O3', '-fomit-frame-pointer')
+class Darwin_PowerPC(Darwin):#xxx fixme, mwp
+ name = "darwin_powerpc"
+ link_flags = ()
+ cflags = ('-O3', '-fomit-frame-pointer')
+
class Darwin_x86_64(Darwin):
name = "darwin_x86_64"
link_flags = ('-arch', 'x86_64')
diff --git a/pypy/translator/platform/test/test_darwin.py
b/pypy/translator/platform/test/test_darwin.py
--- a/pypy/translator/platform/test/test_darwin.py
+++ b/pypy/translator/platform/test/test_darwin.py
@@ -7,7 +7,7 @@
py.test.skip("Darwin only")
from pypy.tool.udir import udir
-from pypy.translator.platform.darwin import Darwin_i386, Darwin_x86_64
+from pypy.translator.platform.darwin import Darwin_i386, Darwin_x86_64,
Darwin_PowerPC
from pypy.translator.platform.test.test_platform import TestPlatform as
BasicTest
from pypy.translator.tool.cbuild import ExternalCompilationInfo
@@ -17,7 +17,7 @@
else:
host_factory = Darwin_x86_64
else:
- host_factory = Darwin
+ host_factory = Darwin_PowerPC
class TestDarwin(BasicTest):
platform = host_factory()
diff --git a/pypy/translator/test/test_simplify.py
b/pypy/translator/test/test_simplify.py
--- a/pypy/translator/test/test_simplify.py
+++ b/pypy/translator/test/test_simplify.py
@@ -42,24 +42,6 @@
assert graph.startblock.operations[0].opname == 'int_mul_ovf'
assert graph.startblock.operations[1].opname == 'int_sub'
-def test_remove_ovfcheck_lshift():
- # check that ovfcheck_lshift() is handled
- from pypy.rlib.rarithmetic import ovfcheck_lshift
- def f(x):
- try:
- return ovfcheck_lshift(x, 2)
- except OverflowError:
- return -42
- graph, _ = translate(f, [int])
- assert len(graph.startblock.operations) == 1
- assert graph.startblock.operations[0].opname == 'int_lshift_ovf'
- assert len(graph.startblock.operations[0].args) == 2
- assert len(graph.startblock.exits) == 2
- assert [link.exitcase for link in graph.startblock.exits] == \
- [None, OverflowError]
- assert [link.target.operations for link in graph.startblock.exits] == \
- [(), ()]
-
def test_remove_ovfcheck_floordiv():
# check that ovfcheck() is handled even if the operation raises
# and catches another exception too, here ZeroDivisionError
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit