[pypy-commit] pypy pypy-pyarray: merge default into branch
mattip
noreply at buildbot.pypy.org
Sat Sep 21 23:38:31 CEST 2013
Author: Matti Picus <matti.picus at gmail.com>
Branch: pypy-pyarray
Changeset: r67049:e8756ac043ff
Date: 2013-09-22 00:37 +0300
http://bitbucket.org/pypy/pypy/changeset/e8756ac043ff/
Log: merge default into branch
diff --git a/pypy/module/_pypyjson/test/test__pypyjson.py b/pypy/module/_pypyjson/test/test__pypyjson.py
--- a/pypy/module/_pypyjson/test/test__pypyjson.py
+++ b/pypy/module/_pypyjson/test/test__pypyjson.py
@@ -1,5 +1,5 @@
# -*- encoding: utf-8 -*-
-import py
+import py, sys
from pypy.module._pypyjson.interp_decoder import JSONDecoder
def test_skip_whitespace():
@@ -16,6 +16,9 @@
class AppTest(object):
spaceconfig = {"objspace.usemodules._pypyjson": True}
+ def setup_class(cls):
+ cls.w_run_on_16bit = cls.space.wrap(sys.maxunicode == 65535)
+
def test_raise_on_unicode(self):
import _pypyjson
raises(TypeError, _pypyjson.loads, u"42")
@@ -178,11 +181,11 @@
raises(ValueError, "_pypyjson.loads('[1: 2]')")
raises(ValueError, "_pypyjson.loads('[1, 2')")
raises(ValueError, """_pypyjson.loads('["extra comma",]')""")
-
+
def test_unicode_surrogate_pair(self):
+ if self.run_on_16bit:
+ skip("XXX fix me or mark definitely skipped")
import _pypyjson
expected = u'z\U0001d120x'
res = _pypyjson.loads('"z\\ud834\\udd20x"')
assert res == expected
-
-
diff --git a/pypy/module/pypyjit/test_pypy_c/test_thread.py b/pypy/module/pypyjit/test_pypy_c/test_thread.py
--- a/pypy/module/pypyjit/test_pypy_c/test_thread.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_thread.py
@@ -1,3 +1,4 @@
+import py
from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC
@@ -50,6 +51,7 @@
""")
def test_lock_acquire_release(self):
+ py.test.skip("test too precise, please fix me")
def main(n):
import threading
lock = threading.Lock()
diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py
--- a/rpython/jit/backend/test/runner_test.py
+++ b/rpython/jit/backend/test/runner_test.py
@@ -2441,6 +2441,32 @@
assert values == [1, 10]
assert self.cpu.get_savedata_ref(deadframe) == random_gcref
+ def test_guard_not_forced_2(self):
+ cpu = self.cpu
+ i0 = BoxInt()
+ i1 = BoxInt()
+ tok = BoxPtr()
+ faildescr = BasicFailDescr(1)
+ ops = [
+ ResOperation(rop.INT_ADD, [i0, ConstInt(10)], i1),
+ ResOperation(rop.FORCE_TOKEN, [], tok),
+ ResOperation(rop.GUARD_NOT_FORCED_2, [], None, descr=faildescr),
+ ResOperation(rop.FINISH, [tok], None, descr=BasicFinalDescr(0))
+ ]
+ ops[-2].setfailargs([i1])
+ looptoken = JitCellToken()
+ self.cpu.compile_loop([i0], ops, looptoken)
+ deadframe = self.cpu.execute_token(looptoken, 20)
+ fail = self.cpu.get_latest_descr(deadframe)
+ assert fail.identifier == 0
+ frame = self.cpu.get_ref_value(deadframe, 0)
+ # actually, we should get the same pointer in 'frame' and 'deadframe'
+ # but it is not the case on LLGraph
+ if not getattr(self.cpu, 'is_llgraph', False):
+ assert frame == deadframe
+ deadframe2 = self.cpu.force(frame)
+ assert self.cpu.get_int_value(deadframe2, 0) == 30
+
def test_call_to_c_function(self):
from rpython.rlib.libffi import CDLL, types, ArgChain, FUNCFLAG_CDECL
from rpython.rtyper.lltypesystem.ll2ctypes import libc_name
diff --git a/rpython/jit/metainterp/history.py b/rpython/jit/metainterp/history.py
--- a/rpython/jit/metainterp/history.py
+++ b/rpython/jit/metainterp/history.py
@@ -651,10 +651,10 @@
_list_all_operations(result, self.operations, omit_finish)
return result
- def summary(self, adding_insns={}): # for debugging
+ def summary(self, adding_insns={}, omit_finish=True): # for debugging
"NOT_RPYTHON"
insns = adding_insns.copy()
- for op in self._all_operations(omit_finish=True):
+ for op in self._all_operations(omit_finish=omit_finish):
opname = op.getopname()
insns[opname] = insns.get(opname, 0) + 1
return insns
@@ -895,10 +895,10 @@
"found %d %r, expected %d" % (found, insn, expected_count))
return insns
- def check_resops(self, expected=None, **check):
+ def check_resops(self, expected=None, omit_finish=True, **check):
insns = {}
for loop in self.get_all_loops():
- insns = loop.summary(adding_insns=insns)
+ insns = loop.summary(adding_insns=insns, omit_finish=omit_finish)
return self._check_insns(insns, expected, check)
def _check_insns(self, insns, expected, check):
diff --git a/rpython/jit/metainterp/test/test_virtualizable.py b/rpython/jit/metainterp/test/test_virtualizable.py
--- a/rpython/jit/metainterp/test/test_virtualizable.py
+++ b/rpython/jit/metainterp/test/test_virtualizable.py
@@ -153,6 +153,33 @@
assert res == 10180
self.check_resops(setfield_gc=0, getfield_gc=2)
+ def test_synchronize_in_return_2(self):
+ myjitdriver = JitDriver(greens = [], reds = ['n', 'xy'],
+ virtualizables = ['xy'])
+ class Foo(object):
+ pass
+ def g(xy, n):
+ myjitdriver.jit_merge_point(xy=xy, n=n)
+ promote_virtualizable(xy, 'inst_x')
+ xy.inst_x += 1
+ return Foo()
+ def f(n):
+ xy = self.setup()
+ promote_virtualizable(xy, 'inst_x')
+ xy.inst_x = 10000
+ m = 10
+ foo = None
+ while m > 0:
+ foo = g(xy, n)
+ m -= 1
+ assert foo is not None
+ promote_virtualizable(xy, 'inst_x')
+ return xy.inst_x
+ res = self.meta_interp(f, [18])
+ assert res == 10010
+ self.check_resops(omit_finish=False,
+ guard_not_forced_2=1, finish=1)
+
def test_virtualizable_and_greens(self):
myjitdriver = JitDriver(greens = ['m'], reds = ['n', 'xy'],
virtualizables = ['xy'])
diff --git a/rpython/rlib/parsing/makepackrat.py b/rpython/rlib/parsing/makepackrat.py
--- a/rpython/rlib/parsing/makepackrat.py
+++ b/rpython/rlib/parsing/makepackrat.py
@@ -668,7 +668,7 @@
value = new.function(value.func_code, frame.f_globals)
if not hasattr(result, key) and key not in forbidden:
setattr(result, key, value)
- if result.__init__ is object.__init__:
+ if result.__init__ == object.__init__:
result.__init__ = pcls.__dict__['__init__']
result.init_parser = pcls.__dict__['__init__']
result._code = visitor.get_code()
diff --git a/rpython/rlib/test/test_runicode.py b/rpython/rlib/test/test_runicode.py
--- a/rpython/rlib/test/test_runicode.py
+++ b/rpython/rlib/test/test_runicode.py
@@ -246,7 +246,8 @@
assert decode('+3AE-', 5, None) == (u'\uDC01', 5)
assert decode('+3AE-x', 6, None) == (u'\uDC01x', 6)
- assert encode(u'\uD801\U000abcde', 2, None) == '+2AHab9ze-'
+ u = u'\uD801\U000abcde'
+ assert encode(u, len(u), None) == '+2AHab9ze-'
assert decode('+2AHab9ze-', 10, None) == (u'\uD801\U000abcde', 10)
diff --git a/rpython/rlib/unicodedata/test/test_ucd.py b/rpython/rlib/unicodedata/test/test_ucd.py
--- a/rpython/rlib/unicodedata/test/test_ucd.py
+++ b/rpython/rlib/unicodedata/test/test_ucd.py
@@ -1,6 +1,7 @@
-from rpython.rlib.runicode import code_to_unichr
+from rpython.rlib.runicode import code_to_unichr, MAXUNICODE
from rpython.rlib.unicodedata import unicodedb_5_2_0
from rpython.rtyper.test.tool import BaseRtypingTest
+from rpython.translator.c.test.test_genc import compile
class TestTranslated(BaseRtypingTest):
@@ -15,8 +16,13 @@
print hex(res)
assert res == f(1)
- def test_code_to_unichr(self):
- def f(c):
- return code_to_unichr(c) + u''
- res = self.ll_to_unicode(self.interpret(f, [0x10346]))
- assert res == u'\U00010346'
+
+def test_code_to_unichr():
+ def f(c):
+ return ord(code_to_unichr(c)[0])
+ f1 = compile(f, [int])
+ got = f1(0x12346)
+ if MAXUNICODE == 65535:
+ assert got == 0xd808 # first char of a pair
+ else:
+ assert got == 0x12346
More information about the pypy-commit
mailing list