[pypy-commit] pypy vmprof-0.4.10: try to install vmprof and see what happens to test_enable and test_native
Author: Antonio Cuni Branch: vmprof-0.4.10 Changeset: r92944:4134cbd25c42 Date: 2017-11-05 11:33 +0100 http://bitbucket.org/pypy/pypy/changeset/4134cbd25c42/ Log:try to install vmprof and see what happens to test_enable and test_native diff --git a/requirements.txt b/requirements.txt --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ cffi>=1.4.0 +vmprof>=0.4.10 # required to parse log files in rvmprof tests # hypothesis is used for test generation on untranslated tests hypothesis ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy assert-rewrite: Fix rpython/memory/ tests
Author: Ronan Lamy Branch: assert-rewrite Changeset: r92945:b7b55dee74c6 Date: 2016-11-29 21:41 + http://bitbucket.org/pypy/pypy/changeset/b7b55dee74c6/ Log:Fix rpython/memory/ tests diff --git a/rpython/memory/test/test_hybrid_gc.py b/rpython/memory/test/test_hybrid_gc.py --- a/rpython/memory/test/test_hybrid_gc.py +++ b/rpython/memory/test/test_hybrid_gc.py @@ -2,6 +2,7 @@ from rpython.rtyper.lltypesystem import lltype from rpython.rtyper.lltypesystem.lloperation import llop +from rpython.rlib.objectmodel import assert_ from rpython.memory.test import test_generational_gc @@ -35,12 +36,12 @@ while i < x: gc.collect() i += 1 -assert ref() is a -assert ref().x == 42 +assert_(ref() is a) +assert_(ref().x == 42) return ref def step2(ref): gc.collect() # 'a' is freed here -assert ref() is None +assert_(ref() is None) def f(x): ref = step1(x) step2(ref) diff --git a/rpython/memory/test/test_incminimark_gc.py b/rpython/memory/test/test_incminimark_gc.py --- a/rpython/memory/test/test_incminimark_gc.py +++ b/rpython/memory/test/test_incminimark_gc.py @@ -2,6 +2,7 @@ from rpython.rtyper.lltypesystem import lltype from rpython.rtyper.lltypesystem.lloperation import llop from rpython.rlib import rgc +from rpython.rlib.objectmodel import assert_ from rpython.memory.test import test_minimark_gc @@ -21,8 +22,8 @@ a.x = 5 wr = weakref.ref(a) llop.gc__collect(lltype.Void) # make everything old -assert wr() is not None -assert a.x == 5 +assert_(wr() is not None) +assert_(a.x == 5) return wr def f(): ref = g() @@ -31,7 +32,7 @@ # to an object not found, but still reachable: b = ref() llop.debug_print(lltype.Void, b) -assert b is not None +assert_(b is not None) llop.gc__collect(lltype.Void) # finish the major cycle # assert does not crash, because 'b' is still kept alive b.x = 42 @@ -46,7 +47,7 @@ def f(): a = A() ref = weakref.ref(a) -assert not rgc.pin(ref) +assert_(not rgc.pin(ref)) self.interpret(f, []) def test_pin_finalizer_not_implemented(self): @@ -63,8 +64,8 @@ def f(): a = A() b = B() -assert not rgc.pin(a) -assert not rgc.pin(b) +assert_(not rgc.pin(a)) +assert_(not rgc.pin(b)) self.interpret(f, []) def test_weakref_to_pinned(self): @@ -75,18 +76,18 @@ pass def g(): a = A() -assert rgc.pin(a) +assert_(rgc.pin(a)) a.x = 100 wr = weakref.ref(a) llop.gc__collect(lltype.Void) -assert wr() is not None -assert a.x == 100 +assert_(wr() is not None) +assert_(a.x == 100) return wr def f(): ref = g() llop.gc__collect(lltype.Void, 1) b = ref() -assert b is not None +assert_(b is not None) b.x = 101 return ref() is b res = self.interpret(f, []) diff --git a/rpython/memory/test/test_transformed_gc.py b/rpython/memory/test/test_transformed_gc.py --- a/rpython/memory/test/test_transformed_gc.py +++ b/rpython/memory/test/test_transformed_gc.py @@ -15,6 +15,7 @@ from rpython.rlib.rstring import StringBuilder from rpython.rlib.rarithmetic import LONG_BIT from rpython.rtyper.rtyper import llinterp_backend +from rpython.rlib.objectmodel import assert_ WORD = LONG_BIT // 8 @@ -804,7 +805,7 @@ [A() for i in range(20)] i = 0 while i < len(alist): -assert idarray[i] == compute_unique_id(alist[i]) +assert_(idarray[i] == compute_unique_id(alist[i])) i += 1 j += 1 lltype.free(idarray, flavor='raw') @@ -855,7 +856,7 @@ if cls.gcname == 'incminimark': marker = cls.marker def cleanup(): -assert marker[0] > 0 +assert_(marker[0] > 0) marker[0] = 0 else: cleanup = None @@ -987,7 +988,7 @@ for i in range(20): x.append((1, lltype.malloc(S))) for i in range(50): -assert l2[i] == l[50 + i] +assert_(l2[i] == l[50 + i]) return 0 return fn @@ -1036,9 +1037,9 @@ while i < x: all[i] = [i] * i i += 1 -assert ref() is a +assert_(ref() is a) ll
[pypy-commit] pypy assert-rewrite: Fix asserts in rpython/rtyper/
Author: Ronan Lamy Branch: assert-rewrite Changeset: r92947:b994fd06043b Date: 2017-11-05 14:43 + http://bitbucket.org/pypy/pypy/changeset/b994fd06043b/ Log:Fix asserts in rpython/rtyper/ diff --git a/rpython/rtyper/lltypesystem/test/test_llarena.py b/rpython/rtyper/lltypesystem/test/test_llarena.py --- a/rpython/rtyper/lltypesystem/test/test_llarena.py +++ b/rpython/rtyper/lltypesystem/test/test_llarena.py @@ -1,5 +1,6 @@ import py, os +from rpython.rlib.objectmodel import assert_ from rpython.rtyper.lltypesystem import lltype, llmemory, rffi, llarena from rpython.rtyper.lltypesystem.llarena import (arena_malloc, arena_reset, arena_reserve, arena_free, round_up_for_allocation, ArenaError, @@ -143,12 +144,12 @@ b = a + round_up_for_allocation(llmemory.sizeof(lltype.Char)) arena_reserve(b, precomputed_size) (b + llmemory.offsetof(SX, 'x')).signed[0] = 123 -assert llmemory.cast_adr_to_ptr(b, SPTR).x == 123 +assert_(llmemory.cast_adr_to_ptr(b, SPTR).x == 123) llmemory.cast_adr_to_ptr(b, SPTR).x += 1 -assert (b + llmemory.offsetof(SX, 'x')).signed[0] == 124 +assert_((b + llmemory.offsetof(SX, 'x')).signed[0] == 124) arena_reset(a, myarenasize, True) arena_reserve(b, round_up_for_allocation(llmemory.sizeof(SX))) -assert llmemory.cast_adr_to_ptr(b, SPTR).x == 0 +assert_(llmemory.cast_adr_to_ptr(b, SPTR).x == 0) arena_free(a) return 42 @@ -334,7 +335,7 @@ arena_reserve(a, llmemory.sizeof(S)) p = llmemory.cast_adr_to_ptr(a + 23432, lltype.Ptr(S)) p.x = 123 -assert p.x == 123 +assert_(p.x == 123) arena_protect(a, 65536, True) result = 0 if testrun == 1: diff --git a/rpython/rtyper/lltypesystem/test/test_llgroup.py b/rpython/rtyper/lltypesystem/test/test_llgroup.py --- a/rpython/rtyper/lltypesystem/test/test_llgroup.py +++ b/rpython/rtyper/lltypesystem/test/test_llgroup.py @@ -1,3 +1,4 @@ +from rpython.rlib.objectmodel import assert_ from rpython.rtyper.lltypesystem.llgroup import * from rpython.rtyper.lltypesystem.lloperation import llop from rpython.rtyper.test.test_llinterp import interpret @@ -76,37 +77,37 @@ # def f(): p = llop.get_group_member(lltype.Ptr(test.S1), grpptr, test.g1a) -assert p == test.p1a +assert_(p == test.p1a) p = llop.get_group_member(lltype.Ptr(test.S1), grpptr, test.g1b) -assert p == test.p1b +assert_(p == test.p1b) p = llop.get_group_member(lltype.Ptr(test.S2), grpptr, test.g2a) -assert p == test.p2a +assert_(p == test.p2a) p = llop.get_group_member(lltype.Ptr(test.S2), grpptr, test.g2b) -assert p == test.p2b +assert_(p == test.p2b) # p = llop.get_next_group_member(lltype.Ptr(test.S2), grpptr, test.g1a, llmemory.sizeof(test.S1)) -assert p == test.p2a +assert_(p == test.p2a) p = llop.get_next_group_member(lltype.Ptr(test.S2), grpptr, test.g2a, llmemory.sizeof(test.S2)) -assert p == test.p2b +assert_(p == test.p2b) p = llop.get_next_group_member(lltype.Ptr(test.S1), grpptr, test.g2b, llmemory.sizeof(test.S2)) -assert p == test.p1b +assert_(p == test.p1b) # expected = [123, 456] for i in range(2): p = llop.get_group_member(lltype.Ptr(test.S1), grpptr, g1x[i]) -assert p.x == expected[i] +assert_(p.x == expected[i]) # for i in range(2): s = llop.extract_ushort(HALFWORD, cslist[i]) p = llop.get_group_member(lltype.Ptr(test.S1), grpptr, s) -assert p == test.p1b -assert cslist[0] & ~MASK == 0x45 << HALFSHIFT -assert cslist[1] & ~MASK == 0x41 << HALFSHIFT -assert cslist[0] >> HALFSHIFT == 0x45 -assert cslist[1] >> (HALFSHIFT+1) == 0x41 >> 1 +assert_(p == test.p1b) +assert_(cslist[0] & ~MASK == 0x45 << HALFSHIFT) +assert_(cslist[1] & ~MASK == 0x41 << HALFSHIFT) +assert_(cslist[0] >> HALFSHIFT == 0x45) +assert_(cslist[1] >> (HALFSHIFT+1) == 0x41 >> 1) # return 42 return f diff --git a/rpython/rtyper/lltypesystem/test/test_llmemory.py b/rpython/rtyper/lltypesystem/test/test_llmemory.py --- a/rpython/rtyper/lltypesystem/test/test_llmemory.py +++ b/rpython/rtyper/lltypesystem/test/test_llmemory.py @@ -1,3 +1,4 @@ +from rpython.rlib.objectmodel import assert_ from rpython.rtyper.lltypesystem.llmemory import * from rpython.rtyper.lltypesystem import lltype from rpython.rtyper.test.test_llinterp import interpret @@ -40,7 +41,7 @@ assert b.signed[0] == 123 b.signed[0] = 234 assert s2.s.x == 234 - + def test_array(): A = lltype.GcArray(lltype.Signed) x = lltype.
[pypy-commit] pypy assert-rewrite: Fix asserts in test_newgc.py
Author: Ronan Lamy Branch: assert-rewrite Changeset: r92948:fe04fd3b8632 Date: 2017-11-05 15:09 + http://bitbucket.org/pypy/pypy/changeset/fe04fd3b8632/ Log:Fix asserts in test_newgc.py diff --git a/rpython/translator/c/test/test_newgc.py b/rpython/translator/c/test/test_newgc.py --- a/rpython/translator/c/test/test_newgc.py +++ b/rpython/translator/c/test/test_newgc.py @@ -9,7 +9,8 @@ from rpython.conftest import option from rpython.rlib import rgc -from rpython.rlib.objectmodel import keepalive_until_here, compute_hash, compute_identity_hash, r_dict +from rpython.rlib.objectmodel import ( +assert_, keepalive_until_here, compute_hash, compute_identity_hash, r_dict) from rpython.rlib.rstring import StringBuilder from rpython.rtyper.lltypesystem import lltype, llmemory, rffi from rpython.rtyper.lltypesystem.lloperation import llop @@ -107,7 +108,7 @@ funcstr = funcsstr[num] if funcstr: return funcstr(arg) -assert 0, 'unreachable' +assert_(0, 'unreachable') cls.funcsstr = funcsstr cls.c_allfuncs = staticmethod(cls._makefunc_str_int(allfuncs)) cls.allfuncs = staticmethod(allfuncs) @@ -516,7 +517,7 @@ if i & 1 == 0: a = A() a.index = i -assert a is not None +assert_(a is not None) weakrefs.append(weakref.ref(a)) if i % 7 == 6: keepalive.append(a) @@ -525,9 +526,9 @@ for i in range(n): a = weakrefs[i]() if i % 7 == 6: -assert a is not None +assert_(a is not None) if a is not None: -assert a.index == i & ~1 +assert_(a.index == i & ~1) else: count_free += 1 return count_free @@ -585,10 +586,10 @@ for n in range(len(dlist)): d = dlist[n] keys = keyslist[n] -assert len(d) == len(keys) +assert_(len(d) == len(keys)) i = 0 while i < len(keys): -assert d[keys[i]] == i +assert_(d[keys[i]] == i) i += 1 return 42 return fn @@ -701,13 +702,13 @@ def does_stuff(): fd = os.open(filename, os.O_WRONLY | os.O_CREAT, 0777) count = os.write(fd, "hello world\n") -assert count == len("hello world\n") +assert_(count == len("hello world\n")) os.close(fd) fd = os.open(filename, os.O_RDONLY, 0777) result = os.lseek(fd, 1, 0) -assert result == 1 +assert_(result == 1) data = os.read(fd, 500) -assert data == "ello world\n" +assert_(data == "ello world\n") os.close(fd) return 0 @@ -870,7 +871,7 @@ # ^^^ likely to trigger a collection xr = xr.prev i += 1 -assert xr is None +assert_(xr is None) def check(xr, n, step): "Check that the identity hashes are still correct." @@ -882,7 +883,7 @@ raise ValueError xr = xr.prev i += 1 -assert xr is None +assert_(xr is None) def h(n): x3 = g(3) @@ -947,7 +948,7 @@ for i in range(20): x.append((1, lltype.malloc(S))) for i in range(50): -assert l2[i] == (40 + i) * 3 +assert_(l2[i] == (40 + i) * 3) return 0 return fn @@ -965,7 +966,7 @@ rgc.ll_arraycopy(l, l2, 40, 0, 50) rgc.collect() for i in range(50): -assert l2[i] == l[40 + i] +assert_(l2[i] == l[40 + i]) return 0 return fn @@ -985,7 +986,7 @@ found = True if x == lltype.cast_opaque_ptr(llmemory.GCREF, s.u): os.write(2, "s.u should not be found!\n") -assert False +assert_(False) return found == 1 def fn(): @@ -994,7 +995,7 @@ found = g(s) if not found: os.write(2, "not found!\n") -assert False +assert_(False) s.u.x = 42 return 0 @@ -1013,8 +1014,8 @@ gcref1 = lltype.cast_opaque_ptr(llmemory.GCREF, s) gcref2 = lltype.cast_opaque_ptr(llmemory.GCREF, s.u) lst = rgc.get_rpy_referents(gcref1) -assert gcref2 in lst -assert gcref1 not in lst +assert_(gcref2 in lst) +assert_(gcref1 not in lst) s.u.x = 42 return 0
[pypy-commit] pypy default: kill test that has been disabled for 6 years
Author: Ronan Lamy Branch: Changeset: r92949:50ba491d0e92 Date: 2017-11-05 15:27 + http://bitbucket.org/pypy/pypy/changeset/50ba491d0e92/ Log:kill test that has been disabled for 6 years diff --git a/rpython/jit/metainterp/test/test_del.py b/rpython/jit/metainterp/test/test_del.py --- a/rpython/jit/metainterp/test/test_del.py +++ b/rpython/jit/metainterp/test/test_del.py @@ -82,46 +82,5 @@ assert res == 1 self.check_resops(call_r=1) # for the case B(), but not for the case A() -def test_keepalive(self): -py.test.skip("XXX fails") # hum, I think the test itself is broken -# -mydriver = JitDriver(reds = ['n', 'states'], greens = []) -class State: -num = 1 -class X: -def __init__(self, state): -self.state = state -def __del__(self): -self.state.num += 1 -@dont_look_inside -def do_stuff(): -pass -def f(n): -states = [] -while n > 0: -mydriver.jit_merge_point(n=n, states=states) -state = State() -states.append(state) -x = X(state) -do_stuff() -state.num *= 1000 -do_stuff() -keepalive_until_here(x) -n -= 1 -return states -def main(n): -states = f(n) -rgc.collect() -rgc.collect() -err = 1001 -for state in states: -if state.num != 1001: -err = state.num -print 'ERROR:', err -return err -assert main(20) == 1001 -res = self.meta_interp(main, [20]) -assert res == 1001 - class TestLLtype(DelTests, LLJitMixin): pass ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: add method used in matplotlib
Author: Matti Picus Branch: Changeset: r92950:bab05da3f317 Date: 2017-11-05 21:17 +0200 http://bitbucket.org/pypy/pypy/changeset/bab05da3f317/ Log:add method used in matplotlib diff --git a/lib_pypy/_tkinter/app.py b/lib_pypy/_tkinter/app.py --- a/lib_pypy/_tkinter/app.py +++ b/lib_pypy/_tkinter/app.py @@ -180,6 +180,9 @@ if err == tklib.TCL_ERROR: self.raiseTclError() +def interpaddr(self): +return int(tkffi.cast('size_t', self.interp)) + def _var_invoke(self, func, *args, **kwargs): if self.threaded and self.thread_id != tklib.Tcl_GetCurrentThread(): # The current thread is not the interpreter thread. ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy assert-rewrite: more assert fixes
Author: Ronan Lamy Branch: assert-rewrite Changeset: r92951:7318052f560c Date: 2017-11-05 20:49 + http://bitbucket.org/pypy/pypy/changeset/7318052f560c/ Log:more assert fixes diff --git a/rpython/jit/metainterp/test/test_ajit.py b/rpython/jit/metainterp/test/test_ajit.py --- a/rpython/jit/metainterp/test/test_ajit.py +++ b/rpython/jit/metainterp/test/test_ajit.py @@ -3,6 +3,7 @@ import py import weakref +from rpython.rlib.objectmodel import assert_ from rpython.rlib import rgc from rpython.jit.codewriter.policy import StopAtXPolicy from rpython.jit.metainterp import history @@ -121,7 +122,7 @@ res += ovfcheck(x * x) y -= 1 except OverflowError: -assert 0 +assert_(0) return res res = self.meta_interp(f, [6, 7]) assert res == 1323 @@ -157,7 +158,7 @@ try: res += ovfcheck(x * x) + b except OverflowError: -assert 0 +assert_(0) y -= 1 return res res = self.meta_interp(f, [6, 7]) @@ -793,7 +794,7 @@ return llop.int_between(lltype.Bool, arg1, arg2, arg3) """ % locals()).compile() in loc res = self.interp_operations(loc['f'], [5, 6, 7]) -assert res == expect_result +assert_(res == expect_result) self.check_operations_history(expect_operations) # check('n', 'm', 'p', True, int_sub=2, uint_lt=1) @@ -997,7 +998,7 @@ while i < 10: myjitdriver.can_enter_jit(i=i, t=t) myjitdriver.jit_merge_point(i=i, t=t) -assert i > 0 +assert_(i > 0) t += int_c_div(100, i) - int_c_mod(100, i) i += 1 return t @@ -1220,7 +1221,7 @@ # to the backend at all: ZeroDivisionError # def f(n): -assert n >= 0 +assert_(n >= 0) try: return ovfcheck(5 % n) except ZeroDivisionError: @@ -1231,7 +1232,7 @@ assert res == -666 # def f(n): -assert n >= 0 +assert_(n >= 0) try: return ovfcheck(6 // n) except ZeroDivisionError: @@ -1350,7 +1351,7 @@ else: obj = A() obj.a = 17 -assert isinstance(obj, B) +assert_(isinstance(obj, B)) return obj.a res = self.interp_operations(fn, [1]) assert res == 1 @@ -1922,8 +1923,8 @@ a2 = f(A(x), y) b1 = f(B(x), y) b2 = f(B(x), y) -assert a1.val == a2.val -assert b1.val == b2.val +assert_(a1.val == a2.val) +assert_(b1.val == b2.val) return a1.val + b1.val res = self.meta_interp(g, [6, 7]) assert res == 6*8 + 6**8 @@ -1966,8 +1967,8 @@ a2 = f(A(x), y) b1 = f(B(x), y) b2 = f(B(x), y) -assert a1.val == a2.val -assert b1.val == b2.val +assert_(a1.val == a2.val) +assert_(b1.val == b2.val) return a1.val + b1.val res = self.meta_interp(g, [6, 20]) assert res == g(6, 20) @@ -2001,16 +2002,16 @@ def g(x, y): a1 = f(A(x), y, A(x)) a2 = f(A(x), y, A(x)) -assert a1.val == a2.val +assert_(a1.val == a2.val) b1 = f(B(x), y, B(x)) b2 = f(B(x), y, B(x)) -assert b1.val == b2.val +assert_(b1.val == b2.val) c1 = f(B(x), y, A(x)) c2 = f(B(x), y, A(x)) -assert c1.val == c2.val +assert_(c1.val == c2.val) d1 = f(A(x), y, B(x)) d2 = f(A(x), y, B(x)) -assert d1.val == d2.val +assert_(d1.val == d2.val) return a1.val + b1.val + c1.val + d1.val res = self.meta_interp(g, [3, 14]) assert res == g(3, 14) @@ -2041,7 +2042,7 @@ def g(x, y): c1 = f(A(x), y, B(x)) c2 = f(A(x), y, B(x)) -assert c1.val == c2.val +assert_(c1.val == c2.val) return c1.val res = self.meta_interp(g, [3, 16]) assert res == g(3, 16) @@ -2068,7 +2069,7 @@ def g(x, y): a1 = f(A(x), y, A(x)) a2 = f(A(x), y, A(x)) -assert a1.val == a2.val +assert_(a1.val == a2.val) return a1.val res = self.meta_interp(g, [3, 14]) assert res == g(3, 14) @@ -2093,7 +2094,7 @@ def g(x, y): a1 = f(A(x), y) a2 = f(A(x), y) -assert a1.val == a2.val +assert_(a1.val == a2.val) return a1.val res = self.me