Commits

mattip committed e8756ac Merge

merge default into branch

Comments (0)

Files changed (8)

pypy/module/_pypyjson/test/test__pypyjson.py

 # -*- encoding: utf-8 -*-
-import py
+import py, sys
 from pypy.module._pypyjson.interp_decoder import JSONDecoder
 
 def test_skip_whitespace():
 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")
         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
-
-

pypy/module/pypyjit/test_pypy_c/test_thread.py

+import py
 from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC
 
 
         """)
 
     def test_lock_acquire_release(self):
+        py.test.skip("test too precise, please fix me")
         def main(n):
             import threading
             lock = threading.Lock()

rpython/jit/backend/test/runner_test.py

         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

rpython/jit/metainterp/history.py

         _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
                 "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):

rpython/jit/metainterp/test/test_virtualizable.py

         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'])

rpython/rlib/parsing/makepackrat.py

                 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()

rpython/rlib/test/test_runicode.py

         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)
 
 

rpython/rlib/unicodedata/test/test_ucd.py

-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):
         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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.