[pypy-commit] pypy default: fix failing test, remove tab
Author: Matti Picus Branch: Changeset: r97925:d91b02c62beb Date: 2019-11-01 05:01 +0200 http://bitbucket.org/pypy/pypy/changeset/d91b02c62beb/ Log:fix failing test, remove tab diff --git a/lib_pypy/_curses_build.py b/lib_pypy/_curses_build.py --- a/lib_pypy/_curses_build.py +++ b/lib_pypy/_curses_build.py @@ -21,7 +21,7 @@ if os.path.exists('/usr/include/ncurses'): return ['/usr/include/ncurses'] if os.path.exists('/usr/include/ncursesw'): - return ['/usr/include/ncursesw'] +return ['/usr/include/ncursesw'] return [] diff --git a/pypy/module/cpyext/test/test_typeobject.py b/pypy/module/cpyext/test/test_typeobject.py --- a/pypy/module/cpyext/test/test_typeobject.py +++ b/pypy/module/cpyext/test/test_typeobject.py @@ -1296,7 +1296,8 @@ except TypeError as e: import sys if '__pypy__' in sys.builtin_module_names: -assert str(e) == 'instance layout conflicts in multiple inheritance' +print(str(e)) +assert 'instance layout conflicts in multiple inheritance' in str(e) else: assert str(e) == ('Error when calling the metaclass bases\n' ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test and the implementation of gcd_binary()
Author: Armin Rigo Branch: Changeset: r96988:c79c569bdd04 Date: 2019-07-14 10:50 +0200 http://bitbucket.org/pypy/pypy/changeset/c79c569bdd04/ Log:Fix the test and the implementation of gcd_binary() diff --git a/rpython/rlib/rbigint.py b/rpython/rlib/rbigint.py --- a/rpython/rlib/rbigint.py +++ b/rpython/rlib/rbigint.py @@ -2971,15 +2971,15 @@ def gcd_binary(a, b): """ Compute the greatest common divisor of non-negative integers a and b using the binary GCD algorithm. Raises ValueError on negative input. """ +if a < 0 or b < 0: +raise ValueError + if a == 0: return b if b == 0: return a -if a < 0 or b < 0: -raise ValueError - shift = 0 while (a | b) & 1 == 0: a >>= 1 diff --git a/rpython/rlib/test/test_rbigint.py b/rpython/rlib/test/test_rbigint.py --- a/rpython/rlib/test/test_rbigint.py +++ b/rpython/rlib/test/test_rbigint.py @@ -839,7 +839,7 @@ def test_gcd(self): assert gcd_binary(2*3*7**2, 2**2*7) == 2*7 -assert gcd_binary(2*3*7**2, -2**2*7) == 2*7 +pytest.raises(ValueError, gcd_binary, 2*3*7**2, -2**2*7) assert gcd_binary(1234, 5678) == 2 assert gcd_binary(13, 13**6) == 13 assert gcd_binary(12, 0) == 12 ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test to match 432d816c6d7b
Author: Armin Rigo Branch: Changeset: r95673:de85e0ef8bdc Date: 2019-01-19 18:06 +0100 http://bitbucket.org/pypy/pypy/changeset/de85e0ef8bdc/ Log:fix the test to match 432d816c6d7b diff --git a/rpython/memory/gc/test/test_direct.py b/rpython/memory/gc/test/test_direct.py --- a/rpython/memory/gc/test/test_direct.py +++ b/rpython/memory/gc/test/test_direct.py @@ -774,7 +774,7 @@ def test_collect_0(self, debuglog): self.gc.collect(1) # start a major debuglog.reset() -self.gc.collect(0) # do ONLY a minor +self.gc.collect(-1) # do ONLY a minor assert debuglog.summary() == {'gc-minor': 1} def test_enable_disable(self, debuglog): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix failing test, rposix_scandir.has_name_bytes no longer exists
Author: Matti PicusBranch: Changeset: r93666:bb18ac9e65d5 Date: 2018-01-14 18:18 +0200 http://bitbucket.org/pypy/pypy/changeset/bb18ac9e65d5/ Log:fix failing test, rposix_scandir.has_name_bytes no longer exists diff --git a/rpython/rlib/test/test_rposix_scandir.py b/rpython/rlib/test/test_rposix_scandir.py --- a/rpython/rlib/test/test_rposix_scandir.py +++ b/rpython/rlib/test/test_rposix_scandir.py @@ -2,19 +2,23 @@ import py from rpython.rlib import rposix_scandir +if sys.platform == 'win32': +basedir = os.environ.get('LOCALAPPDATA', r'C:\users') +func = rposix_scandir.get_name_unicode +else: +basedir = '/' +func = rposix_scandir.get_name_bytes class TestScanDir(object): -@py.test.mark.skipif("sys.platform == 'win32'") # XXX def test_name_bytes(self): -scan = rposix_scandir.opendir('/') +scan = rposix_scandir.opendir(basedir) found = [] while True: p = rposix_scandir.nextentry(scan) if not p: break -assert rposix_scandir.has_name_bytes(p) -found.append(rposix_scandir.get_name_bytes(p)) +found.append(func(p)) rposix_scandir.closedir(scan) found.remove('.') found.remove('..') ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix numpy test suite fail, test needed
Author: Matti PicusBranch: Changeset: r92341:aa8394da03c4 Date: 2017-09-06 21:24 +0300 http://bitbucket.org/pypy/pypy/changeset/aa8394da03c4/ Log:fix numpy test suite fail, test needed diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py --- a/pypy/module/cpyext/api.py +++ b/pypy/module/cpyext/api.py @@ -40,6 +40,7 @@ from rpython.rlib import rawrefcount from rpython.rlib import rthread from rpython.rlib.debug import fatalerror_notb +from rpython.rlib import rstackovf from pypy.objspace.std.typeobject import W_TypeObject, find_best_base from pypy.module.cpyext.cparser import CTypeSpace @@ -940,6 +941,11 @@ message = str(e) state.set_exception(OperationError(space.w_SystemError, space.newtext(message))) +except rstackovf.StackOverflow as e: +rstackovf.check_stack_overflow() +failed = True +state.set_exception(OperationError(space.w_RuntimeError, + space.newtext("maximum recursion depth exceeded"))) else: failed = False ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix failing test, which now passes
Author: Matti PicusBranch: Changeset: r89620:87475b57a469 Date: 2017-01-16 23:00 +0200 http://bitbucket.org/pypy/pypy/changeset/87475b57a469/ Log:fix failing test, which now passes diff --git a/lib-python/2.7/test/test_capi.py b/lib-python/2.7/test/test_capi.py --- a/lib-python/2.7/test/test_capi.py +++ b/lib-python/2.7/test/test_capi.py @@ -26,7 +26,6 @@ skips = [] if support.check_impl_detail(pypy=True): skips += [ -'test_broken_memoryview', 'test_buildvalue_N', 'test_capsule', 'test_lazy_hash_inheritance', diff --git a/lib_pypy/_testcapimodule.c b/lib_pypy/_testcapimodule.c --- a/lib_pypy/_testcapimodule.c +++ b/lib_pypy/_testcapimodule.c @@ -2780,6 +2780,9 @@ m = Py_InitModule("_testcapi", TestMethods); if (m == NULL) return; + +if (PyType_Ready(&_MemoryViewTester_Type) < 0) +return; Py_TYPE(&_HashInheritanceTester_Type)=_Type; ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test (failed on OS/X 64 because x==y==sys.maxint typically)
Author: Armin RigoBranch: Changeset: r86470:6bfe423a36a4 Date: 2016-08-24 11:51 +0200 http://bitbucket.org/pypy/pypy/changeset/6bfe423a36a4/ Log:Fix the test (failed on OS/X 64 because x==y==sys.maxint typically) diff --git a/pypy/module/test_lib_pypy/test_resource.py b/pypy/module/test_lib_pypy/test_resource.py --- a/pypy/module/test_lib_pypy/test_resource.py +++ b/pypy/module/test_lib_pypy/test_resource.py @@ -1,4 +1,5 @@ from __future__ import absolute_import +import sys import os if os.name != 'posix': @@ -47,6 +48,9 @@ # minimal "does not crash" test x, y = resource.getrlimit(resource.RLIMIT_CPU) resource.setrlimit(resource.RLIMIT_CPU, (x, y)) -x += 0.2 -y += 0.3 -resource.setrlimit(resource.RLIMIT_CPU, (x, y))# truncated to ints +# sometimes, x and y are very large (more than 53 bits). +# for these huge values, int(float(x)) > x... +xf = x + 0.2 +yf = y + 0.3 +if int(xf) == x and int(yf) == y: +resource.setrlimit(resource.RLIMIT_CPU, (x, y)) # truncated to ints ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix attrs test in vmprof for empty attrs lists
Author: Tim FelgentreffBranch: Changeset: r86421:6774c47a23c1 Date: 2016-08-22 14:04 +0200 http://bitbucket.org/pypy/pypy/changeset/6774c47a23c1/ Log:fix attrs test in vmprof for empty attrs lists diff --git a/rpython/rlib/rvmprof/rvmprof.py b/rpython/rlib/rvmprof/rvmprof.py --- a/rpython/rlib/rvmprof/rvmprof.py +++ b/rpython/rlib/rvmprof/rvmprof.py @@ -91,7 +91,7 @@ immut = CodeClass.__dict__.get('_immutable_fields_', []) CodeClass._immutable_fields_ = list(immut) + ['_vmprof_unique_id'] attrs = CodeClass.__dict__.get('_attrs_', None) -if attrs: +if attrs is not None: CodeClass._attrs_ = list(attrs) + ['_vmprof_unique_id'] self._code_classes.add(CodeClass) # ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test (shows up on big-endian machines)
Author: Armin RigoBranch: Changeset: r84569:bf3e92056fa4 Date: 2016-05-22 11:32 +0200 http://bitbucket.org/pypy/pypy/changeset/bf3e92056fa4/ Log:Fix the test (shows up on big-endian machines) diff --git a/pypy/module/cpyext/test/test_typeobject.py b/pypy/module/cpyext/test/test_typeobject.py --- a/pypy/module/cpyext/test/test_typeobject.py +++ b/pypy/module/cpyext/test/test_typeobject.py @@ -744,7 +744,7 @@ int intval; PyObject *name; -if (!PyArg_ParseTuple(args, "l", )) +if (!PyArg_ParseTuple(args, "i", )) return NULL; IntLike_Type.tp_flags |= Py_TPFLAGS_DEFAULT; ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test. Now it fails only for subclasses, which is what I
Author: Armin RigoBranch: Changeset: r84321:4e12001044f0 Date: 2016-05-09 09:30 +0200 http://bitbucket.org/pypy/pypy/changeset/4e12001044f0/ Log:Fix the test. Now it fails only for subclasses, which is what I originally expected diff --git a/pypy/module/cpyext/test/test_typeobject.py b/pypy/module/cpyext/test/test_typeobject.py --- a/pypy/module/cpyext/test/test_typeobject.py +++ b/pypy/module/cpyext/test/test_typeobject.py @@ -924,7 +924,6 @@ @pytest.mark.xfail def test_call_tp_dealloc_when_created_from_python(self): -import gc module = self.import_extension('foo', [ ("fetchFooType", "METH_VARARGS", """ @@ -965,7 +964,9 @@ for i in range(10): if module.getCounter() >= 2: break -gc.collect() +# NB. use self.debug_collect() instead of gc.collect(), +# otherwise rawrefcount's dealloc callback doesn't trigger +self.debug_collect() assert module.getCounter() == 2 # class Bar(Foo): @@ -974,5 +975,5 @@ for i in range(10): if module.getCounter() >= 4: break -gc.collect() +self.debug_collect() assert module.getCounter() == 4 ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix another test using PyString_Concat() in a way that is now
Author: Armin RigoBranch: Changeset: r84093:f05e9998737c Date: 2016-05-01 11:49 +0200 http://bitbucket.org/pypy/pypy/changeset/f05e9998737c/ Log:Fix another test using PyString_Concat() in a way that is now crashing---and wrong according to the CPython documentation diff --git a/pypy/module/cpyext/test/test_bytesobject.py b/pypy/module/cpyext/test/test_bytesobject.py --- a/pypy/module/cpyext/test/test_bytesobject.py +++ b/pypy/module/cpyext/test/test_bytesobject.py @@ -145,6 +145,7 @@ """ PyObject ** v; PyObject * left = PyTuple_GetItem(args, 0); +Py_INCREF(left);/* the reference will be stolen! */ v = PyString_Concat(v, PyTuple_GetItem(args, 1)); return *v; ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test
Author: fijal Branch: Changeset: r83465:643df004248e Date: 2016-03-31 16:49 +0200 http://bitbucket.org/pypy/pypy/changeset/643df004248e/ Log:fix the test diff --git a/rpython/jit/metainterp/test/test_virtualref.py b/rpython/jit/metainterp/test/test_virtualref.py --- a/rpython/jit/metainterp/test/test_virtualref.py +++ b/rpython/jit/metainterp/test/test_virtualref.py @@ -578,7 +578,6 @@ n -= 1 return res # -py.test.raises(InvalidVirtualRef, "fn(10)") py.test.raises(UnknownException, "self.meta_interp(fn, [10])") def test_call_virtualref_already_forced(self): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test
Author: fijal Branch: Changeset: r83417:7abe7ba251e5 Date: 2016-03-29 14:16 +0200 http://bitbucket.org/pypy/pypy/changeset/7abe7ba251e5/ Log:fix the test diff --git a/rpython/jit/metainterp/test/test_jitiface.py b/rpython/jit/metainterp/test/test_jitiface.py --- a/rpython/jit/metainterp/test/test_jitiface.py +++ b/rpython/jit/metainterp/test/test_jitiface.py @@ -18,12 +18,12 @@ reasons = [] class MyJitIface(JitHookInterface): -def on_abort(self, reason, jitdriver, greenkey, greenkey_repr, logops, trace): +def on_abort(self, reason, jitdriver, greenkey, greenkey_repr, logops, ops): assert jitdriver is myjitdriver assert len(greenkey) == 1 reasons.append(reason) assert greenkey_repr == 'blah' -assert trace.length() > 1 +assert len(ops) > 1 iface = MyJitIface() ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test, and then fix the code that the test really should complain about
Author: Armin RigoBranch: Changeset: r83085:d0fea664c105 Date: 2016-03-16 20:26 +0100 http://bitbucket.org/pypy/pypy/changeset/d0fea664c105/ Log:Fix the test, and then fix the code that the test really should complain about diff --git a/pypy/module/_vmprof/test/test__vmprof.py b/pypy/module/_vmprof/test/test__vmprof.py --- a/pypy/module/_vmprof/test/test__vmprof.py +++ b/pypy/module/_vmprof/test/test__vmprof.py @@ -72,9 +72,9 @@ def test_enable_ovf(self): import _vmprof -raises(_vmprof.VMProfError, _vmprof.enable, 999, 0) -raises(_vmprof.VMProfError, _vmprof.enable, 999, -2.5) -raises(_vmprof.VMProfError, _vmprof.enable, 999, 1e300) -raises(_vmprof.VMProfError, _vmprof.enable, 999, 1e300 * 1e300) +raises(_vmprof.VMProfError, _vmprof.enable, 2, 0) +raises(_vmprof.VMProfError, _vmprof.enable, 2, -2.5) +raises(_vmprof.VMProfError, _vmprof.enable, 2, 1e300) +raises(_vmprof.VMProfError, _vmprof.enable, 2, 1e300 * 1e300) NaN = (1e300*1e300) / (1e300*1e300) -raises(_vmprof.VMProfError, _vmprof.enable, 999, NaN) +raises(_vmprof.VMProfError, _vmprof.enable, 2, NaN) diff --git a/rpython/rlib/rvmprof/src/vmprof_common.h b/rpython/rlib/rvmprof/src/vmprof_common.h --- a/rpython/rlib/rvmprof/src/vmprof_common.h +++ b/rpython/rlib/rvmprof/src/vmprof_common.h @@ -31,7 +31,7 @@ RPY_EXTERN char *vmprof_init(int fd, double interval, char *interp_name) { -if (interval < 1e-6 || interval >= 1.0) +if (!(interval >= 1e-6 && interval < 1.0)) /* also if it is NaN */ return "bad value for 'interval'"; prepare_interval_usec = (int)(interval * 100.0); ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test
Author: fijal Branch: Changeset: r82519:a53b593b3b95 Date: 2016-02-25 17:53 +0100 http://bitbucket.org/pypy/pypy/changeset/a53b593b3b95/ Log:fix the test diff --git a/rpython/jit/metainterp/test/test_jitdriver.py b/rpython/jit/metainterp/test/test_jitdriver.py --- a/rpython/jit/metainterp/test/test_jitdriver.py +++ b/rpython/jit/metainterp/test/test_jitdriver.py @@ -227,7 +227,7 @@ i += 1 self.meta_interp(f, [0]) -self.check_resops(enter_portal_frame=1, leave_portal_frame=1) +self.check_simple_loop(enter_portal_frame=1, leave_portal_frame=1) class TestLLtype(MultipleJitDriversTests, LLJitMixin): pass ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix a test
Author: fijal Branch: Changeset: r82117:b88cc59e72a4 Date: 2016-02-08 20:54 +0100 http://bitbucket.org/pypy/pypy/changeset/b88cc59e72a4/ Log:fix a test diff --git a/rpython/tool/jitlogparser/test/logtest2.log b/rpython/tool/jitlogparser/test/logtest2.log --- a/rpython/tool/jitlogparser/test/logtest2.log +++ b/rpython/tool/jitlogparser/test/logtest2.log @@ -139,7 +139,7 @@ debug_merge_point(0, 0, ' #12 LOAD_CONST') +289: guard_value(p4, ConstPtr(ptr22), descr=) [p1, p0, p4, p2, p3, p6, p11, p13, p17] debug_merge_point(0, 0, ' #15 COMPARE_OP') -+308: i23 = getfield_gc_pure_i(p11, descr=) ++308: i23 = getfield_gc_i(p11, descr=) +312: i25 = int_lt(i23, 10) guard_true(i25, descr=) [p1, p0, p11, p2, p3, p6, p13] debug_merge_point(0, 0, ' #18 POP_JUMP_IF_FALSE') @@ -285,9 +285,9 @@ +283: p23 = getfield_gc_r(p21, descr=) +287: guard_class(p23, 26517736, descr=) [p1, p0, p15, i22, p23, p21, p2, p3, p4, i5, p6, p11, p13, p17] +299: p25 = getfield_gc_r(p21, descr=) -+303: i26 = getfield_gc_pure_i(p25, descr=) -+307: i27 = getfield_gc_pure_i(p25, descr=) -+311: i28 = getfield_gc_pure_i(p25, descr=) ++303: i26 = getfield_gc_i(p25, descr=) ++307: i27 = getfield_gc_i(p25, descr=) ++311: i28 = getfield_gc_i(p25, descr=) +315: i30 = int_lt(i22, 0) guard_false(i30, descr=) [p1, p0, p15, i22, i28, i27, i26, p2, p3, p4, i5, p6, p11, p13, p17] +325: i31 = int_ge(i22, i28) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test. _PyLong_FromByteArray() always produces nonsense (i.e. a
Author: Armin RigoBranch: Changeset: r81527:e205bcf52d2f Date: 2016-01-03 02:10 +0100 http://bitbucket.org/pypy/pypy/changeset/e205bcf52d2f/ Log:Fix the test. _PyLong_FromByteArray() always produces nonsense (i.e. a different result than CPython), which needs to be fixed. diff --git a/pypy/module/cpyext/test/test_longobject.py b/pypy/module/cpyext/test/test_longobject.py --- a/pypy/module/cpyext/test/test_longobject.py +++ b/pypy/module/cpyext/test/test_longobject.py @@ -175,10 +175,10 @@ little_endian, is_signed); """), ]) -assert module.from_bytearray(True, False) == 0x9ABC -assert module.from_bytearray(True, True) == -0x6543 -assert module.from_bytearray(False, False) == 0xBC9A -assert module.from_bytearray(False, True) == -0x4365 +assert module.from_bytearray(True, False) == 0xBC9A +assert module.from_bytearray(True, True) == -0x4366 +assert module.from_bytearray(False, False) == 0x9ABC +assert module.from_bytearray(False, True) == -0x6544 def test_fromunicode(self): module = self.import_extension('foo', [ ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test
Author: fijal Branch: Changeset: r7:43f8aaef0f6e Date: 2015-10-06 07:24 +0200 http://bitbucket.org/pypy/pypy/changeset/43f8aaef0f6e/ Log:fix the test diff --git a/rpython/jit/metainterp/optimizeopt/optimizer.py b/rpython/jit/metainterp/optimizeopt/optimizer.py --- a/rpython/jit/metainterp/optimizeopt/optimizer.py +++ b/rpython/jit/metainterp/optimizeopt/optimizer.py @@ -646,10 +646,12 @@ def _copy_resume_data_from(self, guard_op, last_guard_op): descr = compile.invent_fail_descr_for_op(guard_op.getopnum(), self, True) -assert isinstance(descr, compile.ResumeGuardCopiedDescr) last_descr = last_guard_op.getdescr() assert isinstance(last_descr, compile.ResumeGuardDescr) -descr.prev = last_descr +if isinstance(descr, compile.ResumeGuardCopiedDescr): +descr.prev = last_descr +else: +descr.copy_all_attributes_from(last_descr) guard_op.setdescr(descr) guard_op.setfailargs(last_guard_op.getfailargs()) descr.store_hash(self.metainterp_sd) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test I hope
Author: fijal Branch: Changeset: r79960:2d352d04adf6 Date: 2015-10-04 10:32 +0200 http://bitbucket.org/pypy/pypy/changeset/2d352d04adf6/ Log:fix this test I hope diff --git a/rpython/jit/metainterp/test/test_fficall.py b/rpython/jit/metainterp/test/test_fficall.py --- a/rpython/jit/metainterp/test/test_fficall.py +++ b/rpython/jit/metainterp/test/test_fficall.py @@ -187,7 +187,10 @@ def test_simple_call_longlong(self, **kwds): kwds.setdefault('supports_longlong', True) -kwds['expected_call_release_gil_i'] = kwds.pop('expected_call_release_gil', 1) +if is_64_bit: +kwds['expected_call_release_gil_i'] = kwds.pop('expected_call_release_gil', 1) +else: +kwds['expected_call_release_gil_f'] = kwds.pop('expected_call_release_gil', 1) maxint32 = 2147483647 a = r_longlong(maxint32) + 1 b = r_longlong(maxint32) + 2 ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test
Author: fijal Branch: Changeset: r79936:d01d9a0ef18b Date: 2015-10-02 15:58 +0200 http://bitbucket.org/pypy/pypy/changeset/d01d9a0ef18b/ Log:fix the test diff --git a/pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py b/pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py --- a/pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py +++ b/pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py @@ -76,6 +76,6 @@ assert len(mod_bridges) in (1, 2, 3) # check that counts are reasonable (precise # may change in the future) -assert N - 2000 < sum(l.count for l in fn_with_bridges_loops) < N + 1000 +assert N - 2000 < sum(l.count for l in fn_with_bridges_loops) < N + 1500 ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix more test(s)
Author: mattipBranch: Changeset: r79605:63de0ec77acd Date: 2015-09-13 14:59 +0300 http://bitbucket.org/pypy/pypy/changeset/63de0ec77acd/ Log:fix more test(s) diff --git a/pypy/module/_rawffi/array.py b/pypy/module/_rawffi/array.py --- a/pypy/module/_rawffi/array.py +++ b/pypy/module/_rawffi/array.py @@ -89,6 +89,7 @@ # function call, ffi_call() writes 8 bytes into it even if the # function's result type asks for less. memsize = clibffi.adjust_return_size(memsize) +import pdb;pdb.set_trace() W_DataInstance.__init__(self, space, memsize, address) self.length = length self.shape = shape 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 @@ -2602,10 +2602,10 @@ ops = [] for i in range(50): ops += [ -ResOperation(rop.CALL_RELEASE_GIL_N, +ResOperation(rop.CALL_RELEASE_GIL_I, [ConstInt(0), funcbox, i1, i2], descr=calldescr), -ResOperation(rop.GUARD_NOT_FORCED, [], None, descr=faildescr), +ResOperation(rop.GUARD_NOT_FORCED, [], descr=faildescr), ] i3 = ops[-2] ops[-1].setfailargs([]) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r78224:743f2cc270b2 Date: 2015-06-21 12:13 +0200 http://bitbucket.org/pypy/pypy/changeset/743f2cc270b2/ Log:fix this test diff --git a/pypy/module/cpyext/test/test_version.py b/pypy/module/cpyext/test/test_version.py --- a/pypy/module/cpyext/test/test_version.py +++ b/pypy/module/cpyext/test/test_version.py @@ -16,7 +16,7 @@ } module = self.import_module(name='foo', init=init) -assert module.py_version == sys.version[:5] +assert module.py_version == '%d.%d.%d' % sys.version_info[:3] assert module.py_major_version == sys.version_info.major assert module.py_minor_version == sys.version_info.minor assert module.py_micro_version == sys.version_info.micro ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r78225:6042b77b9402 Date: 2015-06-21 12:15 +0200 http://bitbucket.org/pypy/pypy/changeset/6042b77b9402/ Log:fix this test diff --git a/pypy/module/struct/test/test_struct.py b/pypy/module/struct/test/test_struct.py --- a/pypy/module/struct/test/test_struct.py +++ b/pypy/module/struct/test/test_struct.py @@ -390,9 +390,9 @@ self.struct.pack(ii, 17, 42) + '\x00' * (19-sz-2)) exc = raises(TypeError, self.struct.pack_into, ii, buffer(b), 0, 17, 42) -assert str(exc.value) == argument must be read-write buffer, not buffer +assert str(exc.value) == must be read-write buffer, not buffer exc = raises(TypeError, self.struct.pack_into, ii, 'test', 0, 17, 42) -assert str(exc.value) == argument must be read-write buffer, not str +assert str(exc.value) == must be read-write buffer, not str exc = raises(self.struct.error, self.struct.pack_into, ii, b[0:1], 0, 17, 42) assert str(exc.value) == pack_into requires a buffer of at least 8 bytes ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test by adding a _fake option that doesn't rely on a pypy-c and
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r77553:e6c259d25dc6 Date: 2015-05-25 21:22 +0200 http://bitbucket.org/pypy/pypy/changeset/e6c259d25dc6/ Log:Fix the test by adding a _fake option that doesn't rely on a pypy-c and libpypy-c.so to be actually built diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py --- a/pypy/tool/release/package.py +++ b/pypy/tool/release/package.py @@ -89,7 +89,7 @@ kwds['stderr'] = subprocess.PIPE return subprocess.call([str(pypy_c), '-c', 'pass'], **kwds) == 0 -def create_package(basedir, options): +def create_package(basedir, options, _fake=False): retval = 0 name = options.name if not name: @@ -105,13 +105,13 @@ pypy_c = basedir.join('pypy', 'goal', basename) else: pypy_c = py.path.local(override_pypy_c) -if not pypy_c.check(): +if not _fake and not pypy_c.check(): raise PyPyCNotFound( 'Expected but did not find %s.' ' Please compile pypy first, using translate.py,' ' or check that you gave the correct path' ' with --override_pypy_c' % pypy_c) -if not pypy_runs(pypy_c): +if not _fake and not pypy_runs(pypy_c): raise OSError(Running %r failed! % (str(pypy_c),)) if not options.no_cffi: try: @@ -124,7 +124,7 @@ binaries = [(pypy_c, rename_pypy_c)] if (sys.platform != 'win32' and# handled below -os.path.getsize(str(pypy_c)) 50): +not _fake and os.path.getsize(str(pypy_c)) 50): # This pypy-c is very small, so it means it relies on libpypy_c.so. # If it would be bigger, it wouldn't. That's a hack. libpypy_name = ('libpypy-c.so' if not sys.platform.startswith('darwin') @@ -227,7 +227,11 @@ bindir.ensure(dir=True) for source, target in binaries: archive = bindir.join(target) -shutil.copy(str(source), str(archive)) +if not _fake: +shutil.copy(str(source), str(archive)) +else: +open(str(archive), 'wb').close() +os.chmod(str(archive), 0755) fix_permissions(pypydir) old_dir = os.getcwd() @@ -276,7 +280,7 @@ print Ready in %s % (builddir,) return retval, builddir # for tests -def package(*args): +def package(*args, **kwds): try: import argparse except ImportError: @@ -337,7 +341,7 @@ from rpython.tool.udir import udir options.builddir = udir.ensure(build, dir=True) assert '/' not in options.pypy_c -return create_package(basedir, options) +return create_package(basedir, options, **kwds) if __name__ == '__main__': diff --git a/pypy/tool/release/test/test_package.py b/pypy/tool/release/test/test_package.py --- a/pypy/tool/release/test/test_package.py +++ b/pypy/tool/release/test/test_package.py @@ -16,25 +16,10 @@ rename_pypy_c = 'pypy' exe_name_in_archive = 'bin/pypy' pypy_c = py.path.local(pypydir).join('goal', basename) -if not pypy_c.check(): -if sys.platform == 'win32': -import os, shutil -for d in os.environ['PATH'].split(';'): -if os.path.exists(os.path.join(d, 'cmd.exe')): -shutil.copy(os.path.join(d, 'cmd.exe'), str(pypy_c)) -break -else: -assert False, 'could not find cmd.exe' -else: -pypy_c.write(#!/bin/sh) -pypy_c.chmod(0755) -fake_pypy_c = True -else: -fake_pypy_c = False try: retval, builddir = package.package( '--without-cffi', str(py.path.local(pypydir).dirpath()), -test, rename_pypy_c) +test, rename_pypy_c, _fake=True) assert retval == 0 prefix = builddir.join(test) cpyver = '%d.%d' % CPYTHON_VERSION[:2] @@ -79,8 +64,7 @@ check_include('pypy_decl.h') check_include('numpy/arrayobject.h') finally: -if fake_pypy_c: -pypy_c.remove() +pass# to keep the indentation def test_with_zipfile_module(): prev = package.USE_ZIPFILE_MODULE ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test (fails in x86/test/test_fficall.py)
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r77353:4bd19526f839 Date: 2015-05-17 17:40 +0200 http://bitbucket.org/pypy/pypy/changeset/4bd19526f839/ Log:fix this test (fails in x86/test/test_fficall.py) diff --git a/rpython/jit/metainterp/test/test_fficall.py b/rpython/jit/metainterp/test/test_fficall.py --- a/rpython/jit/metainterp/test/test_fficall.py +++ b/rpython/jit/metainterp/test/test_fficall.py @@ -53,15 +53,12 @@ cif_description = get_description(atypes, rtype) -expected_args = [] -for avalue in avalues: -if lltype.typeOf(avalue) == rffi.ULONG: -avalue = intmask(avalue) -expected_args.append(avalue) -expected_args = tuple(expected_args) - def verify(*args): -assert args == expected_args +for a, exp_a in zip(args, avalues): +if (lltype.typeOf(exp_a) == rffi.ULONG and +lltype.typeOf(a) == lltype.Signed): +a = rffi.cast(rffi.ULONG, a) +assert a == exp_a return rvalue FUNC = lltype.FuncType([lltype.typeOf(avalue) for avalue in avalues], lltype.typeOf(rvalue)) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix this test
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r74942:db87f8d3abb8 Date: 2014-12-15 16:37 + http://bitbucket.org/pypy/pypy/changeset/db87f8d3abb8/ Log:Fix this test diff --git a/rpython/rtyper/lltypesystem/rordereddict.py b/rpython/rtyper/lltypesystem/rordereddict.py --- a/rpython/rtyper/lltypesystem/rordereddict.py +++ b/rpython/rtyper/lltypesystem/rordereddict.py @@ -72,6 +72,8 @@ 'must_clear_value': (isinstance(DICTVALUE, lltype.Ptr) and DICTVALUE._needsgc()), } +if getattr(ll_eq_function, 'no_direct_compare', False): +entrymeths['no_direct_compare'] = True # * the key entryfields.append((key, DICTKEY)) diff --git a/rpython/rtyper/test/test_rordereddict.py b/rpython/rtyper/test/test_rordereddict.py --- a/rpython/rtyper/test/test_rordereddict.py +++ b/rpython/rtyper/test/test_rordereddict.py @@ -292,9 +292,6 @@ res = self.interpret(func, [5]) assert res == 6 -def test_dict_with_SHORT_keys(self): -py.test.skip(I don't want to edit this file on two branches) - def test_memoryerror_should_not_insert(self): py.test.skip(I don't want to edit this file on two branches) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r73896:48ee7cfde056 Date: 2014-10-10 19:39 +0200 http://bitbucket.org/pypy/pypy/changeset/48ee7cfde056/ Log:Fix the test diff --git a/rpython/jit/metainterp/test/test_tracingopts.py b/rpython/jit/metainterp/test/test_tracingopts.py --- a/rpython/jit/metainterp/test/test_tracingopts.py +++ b/rpython/jit/metainterp/test/test_tracingopts.py @@ -333,11 +333,25 @@ a[-1] = n x1 = a[-1] a[n - n - 1] = n + 1 -return a[-1] + x1 +return a[-1] + x1 + 1000 * a[2] res = self.interp_operations(fn, [7]) assert res == 7 + 7 + 1 self.check_operations_history(setarrayitem_gc=2, -setfield_gc=0) +setfield_gc=2, call=0) + +def test_list_caching_negative_nonzero_init(self): +def fn(n): +a = [42] * n +if n 1000: +a.append(0) +a[-1] = n +x1 = a[-1] +a[n - n - 1] = n + 1 +return a[-1] + x1 + 1000 * a[2] +res = self.interp_operations(fn, [7]) +assert res == 7 + 7 + 1 + 42000 +self.check_operations_history(setarrayitem_gc=2, +setfield_gc=0, call=1) def test_virtualizable_with_array_heap_cache(self): myjitdriver = jit.JitDriver(greens = [], reds = ['n', 'x', 'i', 'frame'], ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test on 32bit
Author: Brian Kearns bdkea...@gmail.com Branch: Changeset: r73900:25e3b114c5ab Date: 2014-10-10 21:29 -0400 http://bitbucket.org/pypy/pypy/changeset/25e3b114c5ab/ Log:fix this test on 32bit diff --git a/pypy/module/micronumpy/test/test_arrayops.py b/pypy/module/micronumpy/test/test_arrayops.py --- a/pypy/module/micronumpy/test/test_arrayops.py +++ b/pypy/module/micronumpy/test/test_arrayops.py @@ -211,7 +211,7 @@ assert np.result_type(1.) is np.dtype('float64') assert np.result_type(1+2j) is np.dtype('complex128') assert np.result_type(1, 1.) is np.dtype('float64') -assert np.result_type(np.array([1, 2])) is np.dtype('int64') +assert np.result_type(np.array([1, 2])) is np.dtype('int') assert np.result_type(np.array([1, 2]), 1, 1+2j) is np.dtype('complex128') assert np.result_type(np.array([1, 2]), 1, 'float64') is np.dtype('float64') assert np.result_type(np.array([1, 2]), 1, None) is np.dtype('float64') ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix jtransform test
Author: Carl Friedrich Bolz cfb...@gmx.de Branch: Changeset: r73831:1a1bcffa25e3 Date: 2014-10-07 09:48 +0200 http://bitbucket.org/pypy/pypy/changeset/1a1bcffa25e3/ Log:fix jtransform test diff --git a/rpython/jit/codewriter/test/test_jtransform.py b/rpython/jit/codewriter/test/test_jtransform.py --- a/rpython/jit/codewriter/test/test_jtransform.py +++ b/rpython/jit/codewriter/test/test_jtransform.py @@ -1296,7 +1296,7 @@ assert op1.args[1] == ('fielddescr', STRUCT, 'inst_x') assert op1.args[2] == ('fielddescr', STRUCT, 'mutate_x') assert op1.result is None -assert op2.opname == 'getfield_gc_i' +assert op2.opname == 'getfield_gc_i_pure' assert len(op2.args) == 2 assert op2.args[0] == v_x assert op2.args[1] == ('fielddescr', STRUCT, 'inst_x') ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test against cpython on win32
Author: Brian Kearns bdkea...@gmail.com Branch: Changeset: r73175:dc7c03274026 Date: 2014-08-29 09:01 -0700 http://bitbucket.org/pypy/pypy/changeset/dc7c03274026/ Log:fix this test against cpython on win32 diff --git a/pypy/module/_file/test/test_file_extra.py b/pypy/module/_file/test/test_file_extra.py --- a/pypy/module/_file/test/test_file_extra.py +++ b/pypy/module/_file/test/test_file_extra.py @@ -554,14 +554,16 @@ import errno, sys f = open(fn) -exc = raises(EnvironmentError, f.truncate, 3) -if sys.platform == 'win32': -assert exc.value.errno == 5 # ERROR_ACCESS_DENIED +exc = raises(IOError, f.truncate, 3) +# CPython explicitly checks the file mode +# PyPy relies on the libc to raise the error +if '__pypy__' not in sys.builtin_module_names: +assert str(exc.value) == File not open for writing else: -# CPython explicitely checks the file mode -# PyPy relies on the libc to raise the error -assert (exc.value.message == File not open for writing or -exc.value.errno == errno.EINVAL) +if sys.platform == 'win32': +assert exc.value.errno == 5 # ERROR_ACCESS_DENIED +else: +assert exc.value.errno == errno.EINVAL f.close() def test_readinto(self): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r72086:e2b1cc741f76 Date: 2014-06-17 10:01 +0200 http://bitbucket.org/pypy/pypy/changeset/e2b1cc741f76/ Log:Fix the test diff --git a/rpython/jit/metainterp/test/test_heapcache.py b/rpython/jit/metainterp/test/test_heapcache.py --- a/rpython/jit/metainterp/test/test_heapcache.py +++ b/rpython/jit/metainterp/test/test_heapcache.py @@ -1,6 +1,6 @@ from rpython.jit.metainterp.heapcache import HeapCache from rpython.jit.metainterp.resoperation import rop -from rpython.jit.metainterp.history import ConstInt, BoxInt +from rpython.jit.metainterp.history import ConstInt, BoxInt, BasicFailDescr box1 = box1 box2 = box2 @@ -550,7 +550,7 @@ assert h.is_unescaped(box2) assert h.getfield(box1, descr1) is box2 -def test_bug_heap_cache_is_cleared_but_not_is_unescaped(self): +def test_bug_heap_cache_is_cleared_but_not_is_unescaped_1(self): # bug if only the getfield() link is cleared (heap_cache) but not # the is_unescaped() flags: we can do later a GETFIELD(box1) which # will give us a fresh box3, which is actually equal to box2. This @@ -564,6 +564,27 @@ h.invalidate_caches(rop.SETFIELD_GC, None, [box1, box2]) assert h.getfield(box1, descr1) is box2 h.invalidate_caches(rop.CALL_MAY_FORCE, None, []) +assert not h.is_unescaped(box1) +assert not h.is_unescaped(box2) +assert h.getfield(box1, descr1) is None + +def test_bug_heap_cache_is_cleared_but_not_is_unescaped_2(self): +h = HeapCache() +h.new(box1) +h.new(box2) +h.setfield(box1, box2, descr1) +h.invalidate_caches(rop.SETFIELD_GC, None, [box1, box2]) +assert h.getfield(box1, descr1) is box2 +descr = BasicFailDescr() +class XTra: +oopspecindex = 0 +OS_ARRAYCOPY = 42 +extraeffect = 5 +EF_LOOPINVARIANT = 1 +EF_ELIDABLE_CANNOT_RAISE = 2 +EF_ELIDABLE_CAN_RAISE = 3 +descr.get_extra_info = XTra +h.invalidate_caches(rop.CALL, descr, []) assert h.is_unescaped(box1) assert h.is_unescaped(box2) assert h.getfield(box1, descr1) is box2 ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r71132:caee1b15d940 Date: 2014-05-01 14:20 +0200 http://bitbucket.org/pypy/pypy/changeset/caee1b15d940/ Log:fix the test diff --git a/pypy/module/pypyjit/test_pypy_c/test_cprofile.py b/pypy/module/pypyjit/test_pypy_c/test_cprofile.py --- a/pypy/module/pypyjit/test_pypy_c/test_cprofile.py +++ b/pypy/module/pypyjit/test_pypy_c/test_cprofile.py @@ -19,13 +19,13 @@ # log = self.run(main, [500]) assert sorted(log.result) == [ -({method 'append' of 'list' objects}, 500), -({method 'disable' of '_lsprof.Profiler' objects}, 1), -({method 'pop' of 'list' objects}, 500), +(method 'append' of 'list' objects, 500), +(method 'disable' of '_lsprof.Profiler' objects, 1), +(method 'pop' of 'list' objects, 500), ] for method in ['append', 'pop']: loop, = log.loops_by_id(method) print loop.ops_by_id(method) -assert 'call(' not in repr(loop.ops_by_id(method)) -assert 'call_may_force(' not in repr(loop.ops_by_id(method)) -assert 'call_cond(' in repr(loop.ops_by_id(method)) +assert ' call(' not in repr(loop.ops_by_id(method)) +assert ' call_may_force(' not in repr(loop.ops_by_id(method)) +assert ' cond_call(' in repr(loop.ops_by_id(method)) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test:
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r71036:d63b49940eff Date: 2014-04-28 09:30 +0200 http://bitbucket.org/pypy/pypy/changeset/d63b49940eff/ Log:Fix the test: - make it pass (O_APPEND missing) - make it fail before the O_APPEND change diff --git a/rpython/rlib/streamio.py b/rpython/rlib/streamio.py --- a/rpython/rlib/streamio.py +++ b/rpython/rlib/streamio.py @@ -40,7 +40,7 @@ from rpython.rlib import rposix from rpython.rlib.rstring import StringBuilder -from os import O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC +from os import O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND O_BINARY = getattr(os, O_BINARY, 0) # (basemode, plus) diff --git a/rpython/rlib/test/test_streamio.py b/rpython/rlib/test/test_streamio.py --- a/rpython/rlib/test/test_streamio.py +++ b/rpython/rlib/test/test_streamio.py @@ -1105,21 +1105,19 @@ signal(SIGALRM, SIG_DFL) def test_append_mode(self): -try: -fo = streamio.open_file_as_stream # shorthand -x = fo('.test.file', 'w') -x.write('abc123') -x.close() +tfn = str(udir.join('streamio-append-mode')) +fo = streamio.open_file_as_stream # shorthand +x = fo(tfn, 'w') +x.write('abc123') +x.close() -x = fo('.test.file', 'a') -x.write('456') -x.close() -x = fo('.test.file', 'r') -assert x.read() == 'abc123456' -x.close() -finally: -if os.path.exists('.test.file'): -os.remove('.test.file') +x = fo(tfn, 'a') +x.seek(0, 0) +x.write('456') +x.close() +x = fo(tfn, 'r') +assert x.read() == 'abc123456' +x.close() # Speed test ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test in 43da018e7015: consistently call new methods on the metainterp
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r70554:0d99c4a82b27 Date: 2014-04-11 16:34 +0200 http://bitbucket.org/pypy/pypy/changeset/0d99c4a82b27/ Log:Fix the test in 43da018e7015: consistently call new methods on the metainterp from both the opimpl_xxx and from resume.py diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py --- a/rpython/jit/metainterp/pyjitpl.py +++ b/rpython/jit/metainterp/pyjitpl.py @@ -387,24 +387,17 @@ @arguments(descr) def opimpl_new(self, sizedescr): -resbox = self.execute_with_descr(rop.NEW, sizedescr) -self.metainterp.heapcache.new(resbox) -return resbox +return self.metainterp.execute_new(sizedescr) @arguments(descr) def opimpl_new_with_vtable(self, sizedescr): cpu = self.metainterp.cpu cls = heaptracker.descr2vtable(cpu, sizedescr) -resbox = self.execute(rop.NEW_WITH_VTABLE, ConstInt(cls)) -self.metainterp.heapcache.new(resbox) -self.metainterp.heapcache.class_now_known(resbox) -return resbox +return self.metainterp.execute_new_with_vtable(ConstInt(cls)) @arguments(box, descr) def opimpl_new_array(self, lengthbox, itemsizedescr): -resbox = self.execute_with_descr(rop.NEW_ARRAY, itemsizedescr, lengthbox) -self.metainterp.heapcache.new_array(resbox, lengthbox) -return resbox +return self.metainterp.execute_new_array(itemsizedescr, lengthbox) @specialize.arg(1) def _do_getarrayitem_gc_any(self, op, arraybox, indexbox, arraydescr): @@ -467,10 +460,8 @@ @arguments(box, box, box, descr) def _opimpl_setarrayitem_gc_any(self, arraybox, indexbox, itembox, arraydescr): -self.execute_with_descr(rop.SETARRAYITEM_GC, arraydescr, arraybox, -indexbox, itembox) -self.metainterp.heapcache.setarrayitem( -arraybox, indexbox, itembox, arraydescr) +self.metainterp.execute_setarrayitem_gc(arraydescr, arraybox, +indexbox, itembox) opimpl_setarrayitem_gc_i = _opimpl_setarrayitem_gc_any opimpl_setarrayitem_gc_r = _opimpl_setarrayitem_gc_any @@ -623,21 +614,22 @@ tobox = self.metainterp.heapcache.getfield(box, fielddescr) if tobox is valuebox: return -# The following test is disabled because buggy. It is supposed +self.metainterp.execute_setfield_gc(fielddescr, box, valuebox) +# The following logic is disabled because buggy. It is supposed # to be: not(we're writing null into a freshly allocated object) # but the bug is that is_unescaped() can be True even after the # field cache is cleared --- see test_ajit:test_unescaped_write_zero -if 1: # tobox is not None or not self.metainterp.heapcache.is_unescaped(box) or not isinstance(valuebox, Const) or valuebox.nonnull(): -self.execute_with_descr(rop.SETFIELD_GC, fielddescr, box, valuebox) -self.metainterp.heapcache.setfield(box, valuebox, fielddescr) +# +# if tobox is not None or not self.metainterp.heapcache.is_unescaped(box) or not isinstance(valuebox, Const) or valuebox.nonnull(): +# self.execute_with_descr(rop.SETFIELD_GC, fielddescr, box, valuebox) +# self.metainterp.heapcache.setfield(box, valuebox, fielddescr) opimpl_setfield_gc_i = _opimpl_setfield_gc_any opimpl_setfield_gc_r = _opimpl_setfield_gc_any opimpl_setfield_gc_f = _opimpl_setfield_gc_any @arguments(box, box, box, descr) def _opimpl_setinteriorfield_gc_any(self, array, index, value, descr): -self.execute_with_descr(rop.SETINTERIORFIELD_GC, descr, -array, index, value) +self.metainterp.execute_setinteriorfield_gc(descr, array, index, value) opimpl_setinteriorfield_gc_i = _opimpl_setinteriorfield_gc_any opimpl_setinteriorfield_gc_f = _opimpl_setinteriorfield_gc_any opimpl_setinteriorfield_gc_r = _opimpl_setinteriorfield_gc_any @@ -664,8 +656,8 @@ @arguments(box, box, box, descr) def _opimpl_raw_store(self, addrbox, offsetbox, valuebox, arraydescr): -self.execute_with_descr(rop.RAW_STORE, arraydescr, -addrbox, offsetbox, valuebox) +self.metainterp.execute_raw_store(arraydescr, + addrbox, offsetbox, valuebox) opimpl_raw_store_i = _opimpl_raw_store opimpl_raw_store_f = _opimpl_raw_store @@ -1891,6 +1883,41 @@ self.attach_debug_info(op) return resbox +def execute_new_with_vtable(self, known_class): +resbox = self.execute_and_record(rop.NEW_WITH_VTABLE, None, + known_class) +self.heapcache.new(resbox) +self.heapcache.class_now_known(resbox) +return resbox +
[pypy-commit] pypy default: Fix x86/test/test_z*
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r70128:855c8b15eee6 Date: 2014-03-20 20:11 +0100 http://bitbucket.org/pypy/pypy/changeset/855c8b15eee6/ Log:Fix x86/test/test_z* diff --git a/rpython/jit/metainterp/optimizeopt/heap.py b/rpython/jit/metainterp/optimizeopt/heap.py --- a/rpython/jit/metainterp/optimizeopt/heap.py +++ b/rpython/jit/metainterp/optimizeopt/heap.py @@ -306,6 +306,7 @@ def _optimize_CALL_DICT_LOOKUP(self, op): descrs = op.getdescr().get_extra_info().extradescrs +assert descrs# translation hint descr1 = descrs[0] descr2 = descrs[1] if descr1 in self.cached_dict_reads: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix array test that was failing after int bounds propagation from array operations
Author: Squeaky squeaky...@gmx.com Branch: Changeset: r69181:f9b8b76b4c41 Date: 2014-02-16 21:10 +0100 http://bitbucket.org/pypy/pypy/changeset/f9b8b76b4c41/ Log:fix array test that was failing after int bounds propagation from array operations diff --git a/pypy/module/pypyjit/test_pypy_c/test_array.py b/pypy/module/pypyjit/test_pypy_c/test_array.py --- a/pypy/module/pypyjit/test_pypy_c/test_array.py +++ b/pypy/module/pypyjit/test_pypy_c/test_array.py @@ -67,26 +67,46 @@ log = self.run(main, []) assert log.result == 73574560 loop, = log.loops_by_filename(self.filepath) -assert loop.match( -i13 = int_lt(i8, 307200) -guard_true(i13, descr=...) -guard_not_invalidated(descr=...) -# the bound check guard on img has been killed (thanks to the asserts) -i14 = getarrayitem_raw(i10, i8, descr=ArrayS .) -i15 = int_add_ovf(i9, i14) -guard_no_overflow(descr=...) -i17 = int_sub(i8, 640) -# the bound check guard on intimg has been killed (thanks to the asserts) -i18 = getarrayitem_raw(i11, i17, descr=ArrayS .) -i19 = int_add_ovf(i18, i15) -guard_no_overflow(descr=...) -# on 64bit, there is a guard checking that i19 actually fits into 32bit -... -setarrayitem_raw(i11, i8, _, descr=ArrayS .) -i28 = int_add(i8, 1) ---TICK-- -jump(..., descr=...) -) + +if sys.maxint == 2 ** 31 - 1: +assert loop.match( +i13 = int_lt(i8, 307200) +guard_true(i13, descr=...) +guard_not_invalidated(descr=...) +# the bound check guard on img has been killed (thanks to the asserts) +i14 = getarrayitem_raw(i10, i8, descr=ArrayS .) +i15 = int_add_ovf(i9, i14) +guard_no_overflow(descr=...) +i17 = int_sub(i8, 640) +# the bound check guard on intimg has been killed (thanks to the asserts) +i18 = getarrayitem_raw(i11, i17, descr=ArrayS .) +i19 = int_add_ovf(i18, i15) +guard_no_overflow(descr=...) +setarrayitem_raw(i11, i8, _, descr=ArrayS .) +i28 = int_add(i8, 1) +--TICK-- +jump(..., descr=...) +) +elif sys.maxint == 2 ** 63 - 1: +assert loop.match( +i13 = int_lt(i8, 307200) +guard_true(i13, descr=...) +guard_not_invalidated(descr=...) +# the bound check guard on img has been killed (thanks to the asserts) +i14 = getarrayitem_raw(i10, i8, descr=ArrayS .) +i15 = int_add(i9, i14) +i17 = int_sub(i8, 640) +# the bound check guard on intimg has been killed (thanks to the asserts) +i18 = getarrayitem_raw(i11, i17, descr=ArrayS .) +i19 = int_add(i18, i15) +# on 64bit, there is a guard checking that i19 actually fits into 32bit +... +setarrayitem_raw(i11, i8, _, descr=ArrayS .) +i28 = int_add(i8, 1) +--TICK-- +jump(..., descr=...) +) + def test_array_of_doubles(self): def main(): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test on 64-bit
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r69098:3a0ef8f31265 Date: 2014-02-08 11:11 +0100 http://bitbucket.org/pypy/pypy/changeset/3a0ef8f31265/ Log:Fix the test on 64-bit diff --git a/rpython/jit/codewriter/longlong.py b/rpython/jit/codewriter/longlong.py --- a/rpython/jit/codewriter/longlong.py +++ b/rpython/jit/codewriter/longlong.py @@ -26,6 +26,7 @@ getrealfloat= lambda x: x gethash = compute_hash gethash_fast= longlong2float.float2longlong +extract_bits= longlong2float.float2longlong is_longlong = lambda TYPE: False # - @@ -42,6 +43,7 @@ getrealfloat= longlong2float.longlong2float gethash = lambda xll: rarithmetic.intmask(xll - (xll 32)) gethash_fast= gethash +extract_bits= lambda x: x is_longlong = lambda TYPE: (TYPE is lltype.SignedLongLong or TYPE is lltype.UnsignedLongLong) 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 @@ -275,7 +275,8 @@ def same_constant(self, other): if isinstance(other, ConstFloat): -return self.value == other.value +return (longlong.extract_bits(self.value) == +longlong.extract_bits(other.value)) return False def nonnull(self): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test added in ae05315ebb9c.
Author: Manuel Jacob Branch: Changeset: r68866:70df1594c35f Date: 2014-01-23 18:43 +0100 http://bitbucket.org/pypy/pypy/changeset/70df1594c35f/ Log:Fix the test added in ae05315ebb9c. diff --git a/rpython/rtyper/raisingops.py b/rpython/rtyper/raisingops.py --- a/rpython/rtyper/raisingops.py +++ b/rpython/rtyper/raisingops.py @@ -87,7 +87,7 @@ if ((r^(x)) = 0 || (r^(y)) = 0); \ else FAIL_OVF(err, integer addition) ''' -r = x + y +r = intmask(r_uint(x) + r_uint(y)) if r^x = 0 or r^y = 0: return r else: @@ -99,7 +99,7 @@ if (r = (x)); \ else FAIL_OVF(integer addition) ''' -r = x + y +r = intmask(r_uint(x) + r_uint(y)) if r = x: return r else: @@ -111,7 +111,7 @@ if ((r^(x)) = 0 || (r^~(y)) = 0); \ else FAIL_OVF(err, integer subtraction) ''' -r = x - y +r = intmask(r_uint(x) - r_uint(y)) if r^x = 0 or r^~y = 0: return r else: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r68201:c4dd095a23ea Date: 2013-11-18 09:37 +0100 http://bitbucket.org/pypy/pypy/changeset/c4dd095a23ea/ Log:Fix the test. diff --git a/rpython/jit/backend/x86/test/test_ztranslation_basic.py b/rpython/jit/backend/x86/test/test_ztranslation_basic.py --- a/rpython/jit/backend/x86/test/test_ztranslation_basic.py +++ b/rpython/jit/backend/x86/test/test_ztranslation_basic.py @@ -1,11 +1,11 @@ from rpython.jit.backend.llsupport.test.ztranslation_test import TranslationTest -from rpython.translator.translator import TranslationContext -from rpython.config.translationoption import DEFL_GC +from rpython.jit.backend.x86.arch import WORD class TestTranslationX86(TranslationTest): def _check_cbuilder(self, cbuilder): # We assume here that we have sse2. If not, the CPUClass # needs to be changed to CPU386_NO_SSE2, but well. -assert '-msse2' in cbuilder.eci.compile_extra -assert '-mfpmath=sse' in cbuilder.eci.compile_extra +if WORD == 4: +assert '-msse2' in cbuilder.eci.compile_extra +assert '-mfpmath=sse' in cbuilder.eci.compile_extra ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test for the bsd builder
Author: Brian Kearns bdkea...@gmail.com Branch: Changeset: r68198:edd6b3a3df4d Date: 2013-11-17 22:22 -0500 http://bitbucket.org/pypy/pypy/changeset/edd6b3a3df4d/ Log:fix this test for the bsd builder diff --git a/pypy/module/test_lib_pypy/test_grp_extra.py b/pypy/module/test_lib_pypy/test_grp_extra.py --- a/pypy/module/test_lib_pypy/test_grp_extra.py +++ b/pypy/module/test_lib_pypy/test_grp_extra.py @@ -16,7 +16,7 @@ except KeyError: continue assert g.gr_gid == 0 -assert g.gr_mem == ['root'] or g.gr_mem == [] +assert 'root' in g.gr_mem or g.gr_mem == [] assert g.gr_name == name assert isinstance(g.gr_passwd, str)# usually just 'x', don't hope :-) break ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test a bit more strictly
Author: Brian Kearns bdkea...@gmail.com Branch: Changeset: r67984:b1014f8d559c Date: 2013-11-12 10:12 -0800 http://bitbucket.org/pypy/pypy/changeset/b1014f8d559c/ Log:fix this test a bit more strictly diff --git a/pypy/module/test_lib_pypy/test_grp_extra.py b/pypy/module/test_lib_pypy/test_grp_extra.py --- a/pypy/module/test_lib_pypy/test_grp_extra.py +++ b/pypy/module/test_lib_pypy/test_grp_extra.py @@ -11,14 +11,18 @@ def test_basic(self): raises(KeyError, self.grp.getgrnam, dEkLofcG) -try: -g = self.grp.getgrnam(root) -except KeyError: -return # no 'root' group on OS/X? -assert g.gr_gid == 0 -assert g.gr_mem == ['root'] or g.gr_mem == [] -assert g.gr_name == 'root' -assert isinstance(g.gr_passwd, str)# usually just 'x', don't hope :-) +for name in [root, wheel]: +try: +g = self.grp.getgrnam(name) +except KeyError: +continue +assert g.gr_gid == 0 +assert g.gr_mem == ['root'] or g.gr_mem == [] +assert g.gr_name == name +assert isinstance(g.gr_passwd, str)# usually just 'x', don't hope :-) +break +else: +raise def test_extra(self): grp = self.grp ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test on win32 (tzset is unix-only)
Author: Brian Kearns bdkea...@gmail.com Branch: Changeset: r67952:b87ac0ef8a37 Date: 2013-11-11 13:13 -0500 http://bitbucket.org/pypy/pypy/changeset/b87ac0ef8a37/ Log:fix this test on win32 (tzset is unix-only) diff --git a/pypy/module/imp/test/test_import.py b/pypy/module/imp/test/test_import.py --- a/pypy/module/imp/test/test_import.py +++ b/pypy/module/imp/test/test_import.py @@ -573,10 +573,10 @@ def test_reimport_builtin_simple_case_1(self): import sys, time -del time.tzset +del time.clock del sys.modules['time'] import time -assert hasattr(time, 'tzset') +assert hasattr(time, 'clock') def test_reimport_builtin_simple_case_2(self): skip(fix me) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test, failing if sys.unicode==65535.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r67036:2e490cdd9f25 Date: 2013-09-21 14:29 +0200 http://bitbucket.org/pypy/pypy/changeset/2e490cdd9f25/ Log:Fix the test, failing if sys.unicode==65535. 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) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test and generate more efficient code.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r65781:caa2340430f2 Date: 2013-07-29 14:59 +0200 http://bitbucket.org/pypy/pypy/changeset/caa2340430f2/ Log:Fix the test and generate more efficient code. diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py --- a/rpython/jit/backend/x86/assembler.py +++ b/rpython/jit/backend/x86/assembler.py @@ -14,7 +14,7 @@ from rpython.rlib.jit import AsmInfo from rpython.jit.backend.model import CompiledLoopToken from rpython.jit.backend.x86.regalloc import (RegAlloc, get_ebp_ofs, -gpr_reg_mgr_cls, xmm_reg_mgr_cls, _register_arguments) +gpr_reg_mgr_cls, xmm_reg_mgr_cls) from rpython.jit.backend.llsupport.regalloc import (get_scale, valid_addressing_size) from rpython.jit.backend.x86.arch import (FRAME_FIXED_SIZE, WORD, IS_X86_64, JITFRAME_FIXED_SIZE, IS_X86_32, @@ -154,7 +154,11 @@ come. mc = codebuf.MachineCodeBlockWrapper() -self._push_all_regs_to_frame(mc, [], supports_floats, callee_only) +# copy registers to the frame, with the exception of the +# 'cond_call_register_arguments' and eax, because these have already +# been saved by the caller +self._push_all_regs_to_frame(mc, cond_call_register_arguments + [eax], + supports_floats, callee_only) if IS_X86_64: mc.SUB(esp, imm(WORD)) self.set_extra_stack_depth(mc, 2 * WORD) @@ -164,7 +168,7 @@ mc.SUB(esp, imm(WORD * 7)) self.set_extra_stack_depth(mc, 8 * WORD) for i in range(4): -mc.MOV_sr(i * WORD, _register_arguments[i].value) +mc.MOV_sr(i * WORD, cond_call_register_arguments[i].value) mc.CALL(eax) if IS_X86_64: mc.ADD(esp, imm(WORD)) @@ -172,8 +176,7 @@ mc.ADD(esp, imm(WORD * 7)) self.set_extra_stack_depth(mc, 0) self._reload_frame_if_necessary(mc, align_stack=True) -self._pop_all_regs_from_frame(mc, [], supports_floats, - callee_only) +self._pop_all_regs_from_frame(mc, [], supports_floats, callee_only) mc.RET() return mc.materialize(self.cpu.asmmemmgr, []) @@ -1755,7 +1758,7 @@ regs = gpr_reg_mgr_cls.save_around_call_regs else: regs = gpr_reg_mgr_cls.all_regs -for i, gpr in enumerate(regs): +for gpr in regs: if gpr not in ignored_regs: v = gpr_reg_mgr_cls.all_reg_indexes[gpr.value] mc.MOV_br(v * WORD + base_ofs, gpr.value) @@ -1777,7 +1780,7 @@ regs = gpr_reg_mgr_cls.save_around_call_regs else: regs = gpr_reg_mgr_cls.all_regs -for i, gpr in enumerate(regs): +for gpr in regs: if gpr not in ignored_regs: v = gpr_reg_mgr_cls.all_reg_indexes[gpr.value] mc.MOV_rb(gpr.value, v * WORD + base_ofs) @@ -2161,11 +2164,29 @@ def label(self): self._check_frame_depth_debug(self.mc) -def cond_call(self, op, gcmap, cond_loc, call_loc): -self.mc.TEST(cond_loc, cond_loc) +def cond_call(self, op, gcmap, loc_cond, imm_func, arglocs): +self.mc.TEST(loc_cond, loc_cond) self.mc.J_il8(rx86.Conditions['Z'], 0) # patched later jmp_adr = self.mc.get_relative_pos() +# self.push_gcmap(self.mc, gcmap, store=True) +# +# first save away the 4 registers from 'cond_call_register_arguments' +# plus the register 'eax' +base_ofs = self.cpu.get_baseofs_of_frame_field() +for gpr in cond_call_register_arguments + [eax]: +v = gpr_reg_mgr_cls.all_reg_indexes[gpr.value] +self.mc.MOV_br(v * WORD + base_ofs, gpr.value) +# +# load the 0-to-4 arguments into these registers +from rpython.jit.backend.x86.jump import remap_frame_layout +remap_frame_layout(self, arglocs, + cond_call_register_arguments[:len(arglocs)], eax) +# +# load the constant address of the function to call into eax +self.mc.MOV(eax, imm_func) +# +# figure out which variant of cond_call_slowpath to call, and call it callee_only = False floats = False if self._regalloc is not None: @@ -2348,5 +2369,7 @@ os.write(2, '[x86/asm] %s\n' % msg) raise NotImplementedError(msg) +cond_call_register_arguments = [edi, esi, edx, ecx] + class BridgeAlreadyCompiled(Exception): pass diff --git a/rpython/jit/backend/x86/regalloc.py b/rpython/jit/backend/x86/regalloc.py --- a/rpython/jit/backend/x86/regalloc.py +++ b/rpython/jit/backend/x86/regalloc.py @@ -119,8 +119,6 @@ for _i, _reg in enumerate(gpr_reg_mgr_cls.all_regs): gpr_reg_mgr_cls.all_reg_indexes[_reg.value] = _i -_register_arguments =
[pypy-commit] pypy default: fix failing test
Author: Carl Friedrich Bolz cfb...@gmx.de Branch: Changeset: r65182:7617f7f1432c Date: 2013-07-04 11:06 +0200 http://bitbucket.org/pypy/pypy/changeset/7617f7f1432c/ Log:fix failing test diff --git a/pypy/module/pypyjit/test_pypy_c/test_string.py b/pypy/module/pypyjit/test_pypy_c/test_string.py --- a/pypy/module/pypyjit/test_pypy_c/test_string.py +++ b/pypy/module/pypyjit/test_pypy_c/test_string.py @@ -80,7 +80,7 @@ i23 = strgetitem(p10, i19) p25 = newstr(1) strsetitem(p25, 0, i23) -p93 = call(ConstClass(fromstr), p25, 16, ConstPtr(ptr70), descr=Callr . rir EF=3) +p93 = call(ConstClass(fromstr), p25, 16, descr=Callr . ri EF=3) guard_no_exception(descr=...) i94 = call(ConstClass(rbigint.toint), p93, descr=Calli . r EF=3) guard_no_exception(descr=...) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix this test to also pass on CPython
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r64849:93a61b856da8 Date: 2013-06-11 13:24 +0200 http://bitbucket.org/pypy/pypy/changeset/93a61b856da8/ Log:Fix this test to also pass on CPython diff --git a/pypy/module/imp/test/test_import.py b/pypy/module/imp/test/test_import.py --- a/pypy/module/imp/test/test_import.py +++ b/pypy/module/imp/test/test_import.py @@ -566,20 +566,19 @@ assert 'setdefaultencoding' in dir(sys) def test_reimport_builtin(self): -# ...but not reload()! -import sys +import sys, time oldpath = sys.path -sys.setdefaultencoding = test_reimport_builtin removed this +time.tzset = test_reimport_builtin removed this -del sys.modules['sys'] -import sys as sys1 -assert sys.modules['sys'] is sys1 is sys +del sys.modules['time'] +import time as time1 +assert sys.modules['time'] is time1 -assert sys.path is oldpath -assert sys.setdefaultencoding == test_reimport_builtin removed this +assert time.tzset == test_reimport_builtin removed this -reload(sys) # fix it for people that want 'setdefaultencoding' -assert sys.setdefaultencoding != test_reimport_builtin removed this +reload(time1) # don't leave a broken time.tzset behind +import time +assert time.tzset != test_reimport_builtin removed this def test_reload_infinite(self): import infinite_reload ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r64797:cb46a58acf67 Date: 2013-06-05 16:06 +0200 http://bitbucket.org/pypy/pypy/changeset/cb46a58acf67/ Log:Fix the test. diff --git a/pypy/module/pypyjit/test_pypy_c/test_misc.py b/pypy/module/pypyjit/test_pypy_c/test_misc.py --- a/pypy/module/pypyjit/test_pypy_c/test_misc.py +++ b/pypy/module/pypyjit/test_pypy_c/test_misc.py @@ -407,5 +407,4 @@ log = self.run(main, [300]) loop, = log.loops_by_id(long_op) -assert loop.match( -) +assert len(loop.ops_by_id(long_op)) == 0 ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix one test, translation too
Author: mattip matti.pi...@gmail.com Branch: Changeset: r64665:f1937be96ddf Date: 2013-05-30 06:37 +0300 http://bitbucket.org/pypy/pypy/changeset/f1937be96ddf/ Log:fix one test, translation too diff --git a/pypy/module/_multiprocessing/interp_connection.py b/pypy/module/_multiprocessing/interp_connection.py --- a/pypy/module/_multiprocessing/interp_connection.py +++ b/pypy/module/_multiprocessing/interp_connection.py @@ -374,7 +374,7 @@ return space.wrap(self) def descr_repr(self, space): -return self._repr(space, self.handle) +return self._repr(space, rffi.cast(rffi.INTPTR_T, self.handle)) def is_valid(self): return self.handle != self.INVALID_HANDLE_VALUE ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix this test and remove some unused imports
Author: Maciej Fijalkowski fij...@gmail.com Branch: Changeset: r64175:e191271d612c Date: 2013-05-15 17:11 +0200 http://bitbucket.org/pypy/pypy/changeset/e191271d612c/ Log:Fix this test and remove some unused imports diff --git a/rpython/jit/metainterp/test/test_compile.py b/rpython/jit/metainterp/test/test_compile.py --- a/rpython/jit/metainterp/test/test_compile.py +++ b/rpython/jit/metainterp/test/test_compile.py @@ -1,10 +1,10 @@ from rpython.config.translationoption import get_combined_translation_config -from rpython.jit.metainterp.history import TargetToken, ConstInt, History, Stats -from rpython.jit.metainterp.history import BoxInt, INT +from rpython.jit.metainterp.history import ConstInt, History, Stats +from rpython.jit.metainterp.history import INT from rpython.jit.metainterp.compile import compile_loop -from rpython.jit.metainterp.compile import ResumeGuardDescr from rpython.jit.metainterp.compile import ResumeGuardCountersInt from rpython.jit.metainterp.compile import compile_tmp_callback +from rpython.jit.metainterp import jitexc from rpython.jit.metainterp import jitprof, typesystem, compile from rpython.jit.metainterp.optimizeopt.test.test_util import LLtypeMixin from rpython.jit.tool.oparser import parse @@ -13,7 +13,7 @@ class FakeCPU(object): class tracker: pass - + ts = typesystem.llhelper def __init__(self): self.seen = [] @@ -41,7 +41,7 @@ loopnumbering = 0 class FakeMetaInterpStaticData(object): - + logger_noopt = FakeLogger() logger_ops = FakeLogger() config = get_combined_translation_config(translating=True) @@ -192,14 +192,13 @@ assert lltype.cast_opaque_ptr(lltype.Ptr(EXC), got) == llexc # class FakeMetaInterpSD: -class ExitFrameWithExceptionRef(Exception): -pass +pass FakeMetaInterpSD.cpu = cpu deadframe = cpu.execute_token(loop_token, -156, -178) fail_descr = cpu.get_latest_descr(deadframe) try: fail_descr.handle_fail(deadframe, FakeMetaInterpSD(), None) -except FakeMetaInterpSD.ExitFrameWithExceptionRef, e: -assert lltype.cast_opaque_ptr(lltype.Ptr(EXC), e.args[1]) == llexc +except jitexc.ExitFrameWithExceptionRef, e: +assert lltype.cast_opaque_ptr(lltype.Ptr(EXC), e.value) == llexc else: assert 0, should have raised ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test
Author: Maciej Fijalkowski fij...@gmail.com Branch: Changeset: r64181:f87522e1a950 Date: 2013-05-15 19:17 +0200 http://bitbucket.org/pypy/pypy/changeset/f87522e1a950/ Log:fix this test diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py --- a/rpython/translator/c/test/test_standalone.py +++ b/rpython/translator/c/test/test_standalone.py @@ -1186,7 +1186,7 @@ config = get_combined_translation_config(translating=True) self.config = config -@entrypoint('test', [lltype.Signed], relax=True, c_name='foo') +@entrypoint('test', [lltype.Signed], c_name='foo') def f(a): return a + 3 ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test - secondary callbacks now do that
Author: Maciej Fijalkowski fij...@gmail.com Branch: Changeset: r64032:afb35608bfbf Date: 2013-05-13 17:54 +0200 http://bitbucket.org/pypy/pypy/changeset/afb35608bfbf/ Log:fix the test - secondary callbacks now do that diff --git a/rpython/translator/c/gcc/test/test_asmgcroot.py b/rpython/translator/c/gcc/test/test_asmgcroot.py --- a/rpython/translator/c/gcc/test/test_asmgcroot.py +++ b/rpython/translator/c/gcc/test/test_asmgcroot.py @@ -195,10 +195,7 @@ @entrypoint(x42, [lltype.Signed, lltype.Signed], c_name='callback') def mycallback(a, b): -rffi.stackcounter.stacks_counter += 1 -llop.gc_stack_bottom(lltype.Void) gc.collect() -rffi.stackcounter.stacks_counter -= 1 return a + b c_source = py.code.Source( ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix this test on llgraph.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r63528:674d0625fe33 Date: 2013-04-20 18:35 +0200 http://bitbucket.org/pypy/pypy/changeset/674d0625fe33/ Log:Fix this test on llgraph. 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 @@ -3943,7 +3943,8 @@ a = lltype.malloc(A, 2, flavor='raw') a[0] = rffi.cast(rffi.SHORT, 666) a[1] = rffi.cast(rffi.SHORT, 777) -a_int = rffi.cast(lltype.Signed, a) +addr = llmemory.cast_ptr_to_adr(a) +a_int = heaptracker.adr2int(addr) print 'a_int:', a_int self.execute_operation(rop.SETARRAYITEM_RAW, [ConstInt(a_int), ConstInt(0), ConstInt(-7654)], ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test after c2e8c09de077
Author: Brian Kearns bdkea...@gmail.com Branch: Changeset: r63085:80ab72ab0def Date: 2013-04-05 21:29 -0400 http://bitbucket.org/pypy/pypy/changeset/80ab72ab0def/ Log:fix this test after c2e8c09de077 diff --git a/pypy/module/_socket/test/test_sock_app.py b/pypy/module/_socket/test/test_sock_app.py --- a/pypy/module/_socket/test/test_sock_app.py +++ b/pypy/module/_socket/test/test_sock_app.py @@ -233,7 +233,7 @@ def test_unknown_addr_as_object(): from pypy.module._socket.interp_socket import addr_as_object -c_addr = lltype.malloc(rsocket._c.sockaddr, flavor='raw') +c_addr = lltype.malloc(rsocket._c.sockaddr, flavor='raw', track_allocation=False) c_addr.c_sa_data[0] = 'c' rffi.setintfield(c_addr, 'c_sa_family', 15) # XXX what size to pass here? for the purpose of this test it has ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test
Author: Maciej Fijalkowski fij...@gmail.com Branch: Changeset: r62957:9c17279f5949 Date: 2013-04-03 10:31 +0200 http://bitbucket.org/pypy/pypy/changeset/9c17279f5949/ Log:fix the test diff --git a/pypy/tool/jitlogparser/test/logtest.log b/pypy/tool/jitlogparser/test/logtest.log --- a/pypy/tool/jitlogparser/test/logtest.log +++ b/pypy/tool/jitlogparser/test/logtest.log @@ -15,7 +15,7 @@ debug_merge_point(0, 'code object f. file 'x.py'. line 2 #12 LOAD_CONST') debug_merge_point(0, 'code object f. file 'x.py'. line 2 #15 COMPARE_OP') +166: i6 = int_lt(i4, 1) -guard_true(i6, descr=Guard3) [p1, p0, p2, p3, i4] +guard_true(i6, descr=Guard0x3) [p1, p0, p2, p3, i4] debug_merge_point(0, 'code object f. file 'x.py'. line 2 #18 POP_JUMP_IF_FALSE') debug_merge_point(0, 'code object f. file 'x.py'. line 2 #21 LOAD_FAST') debug_merge_point(0, 'code object f. file 'x.py'. line 2 #24 LOAD_CONST') @@ -27,7 +27,7 @@ +191: i12 = int_sub(i10, 1) +195: setfield_raw(40564608, i12, descr=SignedFieldDescr pypysig_long_struct.c_value 0) +203: i14 = int_lt(i12, 0) -guard_false(i14, descr=Guard4) [p1, p0, p2, p3, i8, None] +guard_false(i14, descr=Guard0x4) [p1, p0, p2, p3, i8, None] debug_merge_point(0, 'code object f. file 'x.py'. line 2 #9 LOAD_FAST') +213: jump(p0, p1, p2, p3, i8, descr=Loop0) +218: --end of the loop-- ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix gethostbyaddr() test on some versions of MacOSX.
Author: Christian Hudon chr...@pianocktail.org Branch: Changeset: r62614:efd767a61b59 Date: 2013-03-19 14:11 -0700 http://bitbucket.org/pypy/pypy/changeset/efd767a61b59/ Log:Fix gethostbyaddr() test on some versions of MacOSX. diff --git a/pypy/module/_socket/test/test_sock_app.py b/pypy/module/_socket/test/test_sock_app.py --- a/pypy/module/_socket/test/test_sock_app.py +++ b/pypy/module/_socket/test/test_sock_app.py @@ -35,13 +35,15 @@ def test_gethostbyaddr(): host = localhost expected = socket.gethostbyaddr(host) -expecteds = (expected, expected[:2]+(['0.0.0.0'],)) +# On some versions of MacOSX, we get two '0.0.0.0' entries in the addresslist. +expecteds = (expected, expected[:2] + (['0.0.0.0'], ), expected[:2] + (['0.0.0.0']*2, )) ip = space.appexec([w_socket, space.wrap(host)], (_socket, host): return _socket.gethostbyaddr(host)) assert space.unwrap(ip) in expecteds host = 127.0.0.1 expected = socket.gethostbyaddr(host) -expecteds = (expected, expected[:2]+(['0.0.0.0'],)) +# On some versions of MacOSX, we get two '0.0.0.0' entries in the addresslist. +expecteds = (expected, expected[:2] + (['0.0.0.0'], ), expected[:2] + (['0.0.0.0']*2, )) ip = space.appexec([w_socket, space.wrap(host)], (_socket, host): return _socket.gethostbyaddr(host)) assert space.unwrap(ip) in expecteds ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test
Author: Maciej Fijalkowski fij...@gmail.com Branch: Changeset: r62451:9f1099167f6a Date: 2013-03-18 23:41 -0700 http://bitbucket.org/pypy/pypy/changeset/9f1099167f6a/ Log:fix the test diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -11,6 +11,8 @@ .. branch: callback-jit Callbacks from C are now better JITted +.. branch: fix-jit-logs + .. branch: remove-globals-in-jit .. branch: length-hint ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix and test adding no_nul=True annotation to strings in result of splitting on null-byte if maxsplit argument is not -1
Author: Tim Felgentreff timfelgentr...@gmail.com Branch: Changeset: r62316:5f5a391cfee4 Date: 2013-03-12 15:41 +0100 http://bitbucket.org/pypy/pypy/changeset/5f5a391cfee4/ Log:fix and test adding no_nul=True annotation to strings in result of splitting on null-byte if maxsplit argument is not -1 diff --git a/rpython/annotator/test/test_annrpython.py b/rpython/annotator/test/test_annrpython.py --- a/rpython/annotator/test/test_annrpython.py +++ b/rpython/annotator/test/test_annrpython.py @@ -449,7 +449,6 @@ def test_str_split_nul(self): def f(n): return n.split('\0')[0] - a = self.RPythonAnnotator() a.translator.config.translation.check_str_without_nul = True s = a.build_types(f, [annmodel.SomeString(no_nul=False, can_be_None=False)]) @@ -457,6 +456,15 @@ assert not s.can_be_None assert s.no_nul +def g(n): +return n.split('\0', 1)[0] +a = self.RPythonAnnotator() +a.translator.config.translation.check_str_without_nul = True +s = a.build_types(g, [annmodel.SomeString(no_nul=False, can_be_None=False)]) +assert isinstance(s, annmodel.SomeString) +assert not s.can_be_None +assert not s.no_nul + def test_str_splitlines(self): a = self.RPythonAnnotator() def f(a_str): diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py --- a/rpython/annotator/unaryop.py +++ b/rpython/annotator/unaryop.py @@ -496,7 +496,7 @@ def method_split(str, patt, max=-1): getbookkeeper().count(str_split, str, patt) -if patt.is_constant() and patt.const == \0: +if max == -1 and patt.is_constant() and patt.const == \0: no_nul = True else: no_nul = str.no_nul ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test for running against numpy
Author: Brian Kearns bdkea...@gmail.com Branch: Changeset: r61762:22a6275e2e6e Date: 2013-02-25 09:11 -0500 http://bitbucket.org/pypy/pypy/changeset/22a6275e2e6e/ Log:fix this test for running against numpy diff --git a/pypy/module/test_lib_pypy/numpypy/test_numpy.py b/pypy/module/test_lib_pypy/numpypy/test_numpy.py --- a/pypy/module/test_lib_pypy/numpypy/test_numpy.py +++ b/pypy/module/test_lib_pypy/numpypy/test_numpy.py @@ -55,7 +55,8 @@ numpypy.core.multiarray.set_string_function def test_constants(self): +import math import numpypy assert numpypy.PZERO == numpypy.NZERO == 0.0 -assert numpypy.inf is float('inf') -assert numpypy.nan is float('nan') +assert math.isinf(numpypy.inf) +assert math.isnan(numpypy.nan) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test: this now raises a thread.error
Author: Brian Kearns bdkea...@gmail.com Branch: Changeset: r61333:b53715e21d4d Date: 2013-02-16 16:09 -0500 http://bitbucket.org/pypy/pypy/changeset/b53715e21d4d/ Log:fix the test: this now raises a thread.error diff --git a/pypy/module/__pypy__/test/test_signal.py b/pypy/module/__pypy__/test/test_signal.py --- a/pypy/module/__pypy__/test/test_signal.py +++ b/pypy/module/__pypy__/test/test_signal.py @@ -17,12 +17,12 @@ spaceconfig = dict(usemodules=['__pypy__', 'thread', 'signal', 'time']) def test_exit_twice(self): -from __pypy__ import thread -thread._signals_exit() +import __pypy__, thread +__pypy__.thread._signals_exit() try: -raises(KeyError, thread._signals_exit) +raises(thread.error, __pypy__.thread._signals_exit) finally: -thread._signals_enter() +__pypy__.thread._signals_enter() def test_enable_signals(self): import __pypy__, thread, signal, time ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test for 32bit
Author: Maciej Fijalkowski fij...@gmail.com Branch: Changeset: r61248:57adf4d24214 Date: 2013-02-15 11:48 +0200 http://bitbucket.org/pypy/pypy/changeset/57adf4d24214/ Log:fix the test for 32bit diff --git a/rpython/rlib/test/test_rarithmetic.py b/rpython/rlib/test/test_rarithmetic.py --- a/rpython/rlib/test/test_rarithmetic.py +++ b/rpython/rlib/test/test_rarithmetic.py @@ -400,8 +400,8 @@ assert rffi.cast(lltype.Signed, byteswap(rffi.cast(rffi.USHORT, 0x0102))) == 0x0201 assert rffi.cast(lltype.Signed, byteswap(rffi.cast(rffi.INT, 0x01020304))) == 0x04030201 -assert byteswap(rffi.cast(rffi.ULONGLONG, 0x0102030405060708L)) == 0x0807060504030201L -assert byteswap(rffi.cast(rffi.LONGLONG, 0x0102030405060708L)) == 0x0807060504030201L +assert byteswap(r_ulonglong(0x0102030405060708L)) == r_ulonglong(0x0807060504030201L) +assert byteswap(r_longlong(0x0102030405060708L)) == r_longlong(0x0807060504030201L) assert ((byteswap(2.3) - 1.903598566252326e+185) / 1e185) 0.01 assert (rffi.cast(lltype.Float, byteswap(rffi.cast(lltype.SingleFloat, 2.3))) - 4.173496037651603e-08) 1e-16 ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test: it wasn't testing what it claimed to because it was constructing
Author: Brian Kearns bdkea...@gmail.com Branch: Changeset: r61160:1aa187fce1db Date: 2013-02-13 00:30 -0500 http://bitbucket.org/pypy/pypy/changeset/1aa187fce1db/ Log:fix this test: it wasn't testing what it claimed to because it was constructing seekable sources for a no-seek-available test diff --git a/rpython/rlib/test/test_streamio.py b/rpython/rlib/test/test_streamio.py --- a/rpython/rlib/test/test_streamio.py +++ b/rpython/rlib/test/test_streamio.py @@ -12,18 +12,24 @@ class TSource(streamio.Stream): -def __init__(self, packets): +def __init__(self, packets, tell=True, seek=True): for x in packets: assert x self.orig_packets = packets[:] self.packets = packets[:] self.pos = 0 self.chunks = [] +self._tell = tell +self._seek = seek def tell(self): +if not self._tell: +raise streamio.MyNotImplementedError return self.pos def seek(self, offset, whence=0): +if not self._seek: +raise streamio.MyNotImplementedError if whence == 1: offset += self.pos elif whence == 2: @@ -391,7 +397,7 @@ cases = cases[:7] # pick some cases at random - too slow! def f(): for readto, seekto, whence in cases: -base = TSource(self.packets) +base = TSource(self.packets, seek=False) file = streamio.BufferingInputStream(base) head = file.read(readto) assert head == all[:readto] ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test on windows
Author: Brian Kearns bdkea...@gmail.com Branch: Changeset: r60947:100529d2dbf1 Date: 2013-02-07 19:56 -0500 http://bitbucket.org/pypy/pypy/changeset/100529d2dbf1/ Log:fix this test on windows 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 @@ -514,12 +514,14 @@ assert res == '1\n' def test_popen_child_fds(self): -os = self.posix -from os.path import join -with open(join(self.pdir, 'file1'), 'r') as fd: -with os.popen('%s -c import os; print os.read(%d, 10)' % (self.python, fd.fileno())) as stream: +import os +with open(os.path.join(self.pdir, 'file1'), 'r') as fd: +with self.posix.popen('%s -c import os; print os.read(%d, 10) 21' % (self.python, fd.fileno())) as stream: res = stream.read() -assert res == 'test1\n' +if os.name == 'nt': +assert '\nOSError: [Errno 9]' in res +else: +assert res == 'test1\n' if hasattr(__import__(os.name), '_getfullpathname'): def test__getfullpathname(self): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix till test passes
Author: mattip matti.pi...@gmail.com Branch: Changeset: r59865:65392c9700e4 Date: 2013-01-08 00:10 +0200 http://bitbucket.org/pypy/pypy/changeset/65392c9700e4/ Log:fix till test passes diff --git a/pypy/translator/platform/test/test_platform.py b/pypy/translator/platform/test/test_platform.py --- a/pypy/translator/platform/test/test_platform.py +++ b/pypy/translator/platform/test/test_platform.py @@ -67,7 +67,7 @@ for i in range(900): txt += 'j += func%03d();\n' % i txt += 'printf(%d\\n, j);\n' -txt += 'return j;};\n' +txt += 'return 0;};\n' cfile = udir.join('test_900_files.c') cfile.write(txt) cfiles = [cfile] @@ -84,7 +84,7 @@ mk.write() self.platform.execute_makefile(mk) res = self.platform.execute(udir.join('test_900_files')) -self.check_res(res, sum(range(900))) +self.check_res(res, '%d\n' %sum(range(900))) def test_nice_errors(self): diff --git a/pypy/translator/platform/windows.py b/pypy/translator/platform/windows.py --- a/pypy/translator/platform/windows.py +++ b/pypy/translator/platform/windows.py @@ -328,23 +328,30 @@ m.rule(*rule) objects = ' $(OBJECTS)' -create_obj_response_file = '' +create_obj_response_file = [] if len(' '.join(rel_ofiles)) 4000: -create_obj_response_file = 'echo $(OBJECTS) obj_names.rsp' +# cmd.exe has a limit of ~4000 characters before a command line is too long. +# Use a response file instead, at the cost of making the Makefile very ugly. +for i in range(len(rel_ofiles) - 1): +create_obj_response_file.append('echo %s obj_names.rsp' % \ +rel_ofiles[i]) +# use cmd /c for the last one so that the file is flushed +create_obj_response_file.append('cmd /c echo %s obj_names.rsp' % \ +rel_ofiles[-1]) objects = ' @obj_names.rsp' if self.version 80: m.rule('$(TARGET)', '$(OBJECTS)', -[create_obj_response_file, +create_obj_response_file + [\ '$(CC_LINK) /nologo $(LDFLAGS) $(LDFLAGSEXTRA)' + objects + ' /out:$@ $(LIBDIRS) $(LIBS)', ]) else: m.rule('$(TARGET)', '$(OBJECTS)', - [create_obj_response_file, +create_obj_response_file + [\ '$(CC_LINK) /nologo $(LDFLAGS) $(LDFLAGSEXTRA)' + objects + ' $(LINKFILES) /out:$@ $(LIBDIRS) $(LIBS) /MANIFEST /MANIFESTFILE:$*.manifest', 'mt.exe -nologo -manifest $*.manifest -outputresource:$@;1', ]) m.rule('debugmode_$(TARGET)', '$(OBJECTS)', - [create_obj_response_file, +create_obj_response_file + [\ '$(CC_LINK) /nologo /DEBUG $(LDFLAGS) $(LDFLAGSEXTRA)' + objects + ' $(LINKFILES) /out:$@ $(LIBDIRS) $(LIBS)', ]) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix this test when run together with test_posix2.py.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r59148:e885df77366e Date: 2012-11-29 20:45 -0800 http://bitbucket.org/pypy/pypy/changeset/e885df77366e/ Log:Fix this test when run together with test_posix2.py. diff --git a/pypy/module/posix/test/test_posix_libfile.py b/pypy/module/posix/test/test_posix_libfile.py --- a/pypy/module/posix/test/test_posix_libfile.py +++ b/pypy/module/posix/test/test_posix_libfile.py @@ -2,7 +2,7 @@ import os def setup_module(mod): -mod.path = udir.join('posixtestfile.txt') +mod.path = udir.join('test_posix_libfile.txt') mod.path.write(this is a test) class AppTestPosix: ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test, with explanation of why.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r58856:0e6161a009c6 Date: 2012-11-13 15:40 +0100 http://bitbucket.org/pypy/pypy/changeset/0e6161a009c6/ Log:Fix the test, with explanation of why. diff --git a/pypy/module/micronumpy/test/test_complex.py b/pypy/module/micronumpy/test/test_complex.py --- a/pypy/module/micronumpy/test/test_complex.py +++ b/pypy/module/micronumpy/test/test_complex.py @@ -95,6 +95,8 @@ retVal = c_pow(*args) return retVal except ValueError, e: +if option.runappdirect: +raise raise OperationError(cls.space.w_ValueError, cls.space.wrap(e.message)) cls.w_c_pow = cls.space.wrap(cls_c_pow) @@ -323,7 +325,11 @@ cmpl = complex from math import copysign from _numpypy import power, array, complex128, complex64 -for c,rel_err in ((complex128, 2e-15), (complex64, 4e-7)): +# note: in some settings (namely a x86-32 build without the JIT), +# gcc optimizes the code in rlib.rcomplex.c_pow() to not truncate +# the 10-byte values down to 8-byte values. It ends up with more +# imprecision than usual (hence 2e-13 instead of 2e-15). +for c,rel_err in ((complex128, 2e-13), (complex64, 4e-7)): a = array([cmpl(-5., 0), cmpl(-5., -5.), cmpl(-5., 5.), cmpl(0., -5.), cmpl(0., 0.), cmpl(0., 5.), cmpl(-0., -5.), cmpl(-0., 0.), cmpl(-0., 5.), ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r58655:bf186ea46cc9 Date: 2012-10-31 18:16 +0100 http://bitbucket.org/pypy/pypy/changeset/bf186ea46cc9/ Log:fix this test diff --git a/pypy/interpreter/test/test_zzpickle_and_slow.py b/pypy/interpreter/test/test_zzpickle_and_slow.py --- a/pypy/interpreter/test/test_zzpickle_and_slow.py +++ b/pypy/interpreter/test/test_zzpickle_and_slow.py @@ -6,7 +6,7 @@ class AppTestSlow: def setup_class(cls): -space = gettestobjspace() +space = gettestobjspace(usemodules=['itertools']) cls.space = space if py.test.config.option.runappdirect: filename = __file__ ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test too
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r58656:2598c9981962 Date: 2012-10-31 18:18 +0100 http://bitbucket.org/pypy/pypy/changeset/2598c9981962/ Log:fix this test too diff --git a/pypy/module/_multiprocessing/test/test_connection.py b/pypy/module/_multiprocessing/test/test_connection.py --- a/pypy/module/_multiprocessing/test/test_connection.py +++ b/pypy/module/_multiprocessing/test/test_connection.py @@ -94,7 +94,7 @@ class AppTestSocketConnection(BaseConnectionTest): def setup_class(cls): space = gettestobjspace(usemodules=('_multiprocessing', 'thread', 'signal', -'struct', 'array')) +'struct', 'array', 'itertools')) cls.space = space cls.w_connections = space.newlist([]) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r58541:e7004e804a53 Date: 2012-10-28 18:46 +0100 http://bitbucket.org/pypy/pypy/changeset/e7004e804a53/ Log:Fix the test. diff --git a/pypy/jit/metainterp/test/test_list.py b/pypy/jit/metainterp/test/test_list.py --- a/pypy/jit/metainterp/test/test_list.py +++ b/pypy/jit/metainterp/test/test_list.py @@ -137,7 +137,7 @@ return l2[0] + l2[1] + l2[2] + l2[3] res = self.interp_operations(f, [], listops=True) -assert res == 10 +assert res == f() def test_arraycopy_full(self): jitdriver = JitDriver(greens = [], reds = ['n']) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test by forcing it to run with the old value 'max_unroll_loops=5'.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r57546:dc536a1f2a7e Date: 2012-09-25 09:50 +0200 http://bitbucket.org/pypy/pypy/changeset/dc536a1f2a7e/ Log:Fix the test by forcing it to run with the old value 'max_unroll_loops=5'. diff --git a/pypy/jit/metainterp/test/test_ajit.py b/pypy/jit/metainterp/test/test_ajit.py --- a/pypy/jit/metainterp/test/test_ajit.py +++ b/pypy/jit/metainterp/test/test_ajit.py @@ -2028,6 +2028,7 @@ y -= 1 return res def g(x, y): +set_param(myjitdriver, 'max_unroll_loops', 5) a1 = f(A(x), y) a2 = f(A(x), y) b1 = f(B(x), y) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test by allowing a different exception in two corner error cases.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r57508:d6c016e3e5b1 Date: 2012-09-24 18:06 +0200 http://bitbucket.org/pypy/pypy/changeset/d6c016e3e5b1/ Log:Fix the test by allowing a different exception in two corner error cases. diff --git a/lib-python/2.7/test/test_csv.py b/lib-python/2.7/test/test_csv.py --- a/lib-python/2.7/test/test_csv.py +++ b/lib-python/2.7/test/test_csv.py @@ -59,7 +59,8 @@ self.assertRaises((TypeError, AttributeError), setattr, obj.dialect, 'delimiter', ':') self.assertRaises(AttributeError, delattr, obj.dialect, 'quoting') -self.assertRaises(AttributeError, setattr, obj.dialect, +# PyPy gets a TypeError instead of an AttributeError +self.assertRaises((AttributeError, TypeError), setattr, obj.dialect, 'quoting', None) def test_reader_attrs(self): @@ -133,7 +134,8 @@ os.unlink(name) def test_write_arg_valid(self): -self.assertRaises(csv.Error, self._write_test, None, '') +# PyPy gets a TypeError instead of a csv.Error for not a sequence +self.assertRaises((csv.Error, TypeError), self._write_test, None, '') self._write_test((), '') self._write_test([None], '') self.assertRaises(csv.Error, self._write_test, ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test
Author: Maciej Fijalkowski fij...@gmail.com Branch: Changeset: r56667:c5bf753ea9c2 Date: 2012-08-09 22:43 +0200 http://bitbucket.org/pypy/pypy/changeset/c5bf753ea9c2/ Log:fix the test diff --git a/pypy/jit/backend/x86/test/test_ztranslation.py b/pypy/jit/backend/x86/test/test_ztranslation.py --- a/pypy/jit/backend/x86/test/test_ztranslation.py +++ b/pypy/jit/backend/x86/test/test_ztranslation.py @@ -187,7 +187,8 @@ return len(ll_times) res = self.meta_interp(main, []) -assert res == 1 +assert res == 3 +# one for loop, one for entry point and one for the prologue class TestTranslationRemoveTypePtrX86(CCompiledMixin): CPUClass = getcpuclass() ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test
Author: Maciej Fijalkowski fij...@gmail.com Branch: Changeset: r56232:1ff82b0fd699 Date: 2012-07-19 21:09 +0200 http://bitbucket.org/pypy/pypy/changeset/1ff82b0fd699/ Log:fix the test diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -17,8 +17,9 @@ .. branch: iterator-in-rpython .. branch: numpypy_count_nonzero .. branch: even-more-jit-hooks - +Implement better JIT hooks .. uninteresting branches that we should just ignore for the whatsnew: .. branch: slightly-shorter-c .. branch: better-enforceargs +.. branch: rpython-unicode-formatting ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test, hopefully
Author: Maciej Fijalkowski fij...@gmail.com Branch: Changeset: r56233:c7e24af05881 Date: 2012-07-19 21:10 +0200 http://bitbucket.org/pypy/pypy/changeset/c7e24af05881/ Log:fix the test, hopefully diff --git a/pypy/jit/backend/x86/test/test_ztranslation.py b/pypy/jit/backend/x86/test/test_ztranslation.py --- a/pypy/jit/backend/x86/test/test_ztranslation.py +++ b/pypy/jit/backend/x86/test/test_ztranslation.py @@ -181,6 +181,7 @@ i += 1 def main(): +jit_hooks.stats_set_debug(None, True) f() ll_times = jit_hooks.stats_get_loop_run_times(None) return len(ll_times) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r55279:c6a1519817b1 Date: 2012-06-03 11:00 +0200 http://bitbucket.org/pypy/pypy/changeset/c6a1519817b1/ Log:Fix the test. diff --git a/pypy/jit/backend/test/runner_test.py b/pypy/jit/backend/test/runner_test.py --- a/pypy/jit/backend/test/runner_test.py +++ b/pypy/jit/backend/test/runner_test.py @@ -1835,12 +1835,12 @@ assert not excvalue def test_cond_call_gc_wb(self): -def func_void(a, b): -record.append((a, b)) +def func_void(a): +record.append(a) record = [] # S = lltype.GcStruct('S', ('tid', lltype.Signed)) -FUNC = self.FuncType([lltype.Ptr(S), lltype.Ptr(S)], lltype.Void) +FUNC = self.FuncType([lltype.Ptr(S)], lltype.Void) func_ptr = llhelper(lltype.Ptr(FUNC), func_void) funcbox = self.get_funcbox(self.cpu, func_ptr) class WriteBarrierDescr(AbstractDescr): @@ -1866,26 +1866,25 @@ [BoxPtr(sgcref), ConstPtr(tgcref)], 'void', descr=WriteBarrierDescr()) if cond: -assert record == [(s, t)] +assert record == [s] else: assert record == [] def test_cond_call_gc_wb_array(self): -def func_void(a, b, c): -record.append((a, b, c)) +def func_void(a): +record.append(a) record = [] # S = lltype.GcStruct('S', ('tid', lltype.Signed)) -FUNC = self.FuncType([lltype.Ptr(S), lltype.Signed, lltype.Ptr(S)], - lltype.Void) +FUNC = self.FuncType([lltype.Ptr(S)], lltype.Void) func_ptr = llhelper(lltype.Ptr(FUNC), func_void) funcbox = self.get_funcbox(self.cpu, func_ptr) class WriteBarrierDescr(AbstractDescr): jit_wb_if_flag = 4096 jit_wb_if_flag_byteofs = struct.pack(i, 4096).index('\x10') jit_wb_if_flag_singlebyte = 0x10 -jit_wb_cards_set = 0 -def get_write_barrier_from_array_fn(self, cpu): +jit_wb_cards_set = 0 # = without card marking +def get_write_barrier_fn(self, cpu): return funcbox.getint() # for cond in [False, True]: @@ -1902,13 +1901,15 @@ [BoxPtr(sgcref), ConstInt(123), BoxPtr(sgcref)], 'void', descr=WriteBarrierDescr()) if cond: -assert record == [(s, 123, s)] +assert record == [s] else: assert record == [] def test_cond_call_gc_wb_array_card_marking_fast_path(self): -def func_void(a, b, c): -record.append((a, b, c)) +def func_void(a): +record.append(a) +if cond == 1: # the write barrier sets the flag +s.data.tid |= 32768 record = [] # S = lltype.Struct('S', ('tid', lltype.Signed)) @@ -1922,34 +1923,40 @@ ('card6', lltype.Char), ('card7', lltype.Char), ('data', S)) -FUNC = self.FuncType([lltype.Ptr(S), lltype.Signed, lltype.Ptr(S)], - lltype.Void) +FUNC = self.FuncType([lltype.Ptr(S)], lltype.Void) func_ptr = llhelper(lltype.Ptr(FUNC), func_void) funcbox = self.get_funcbox(self.cpu, func_ptr) class WriteBarrierDescr(AbstractDescr): jit_wb_if_flag = 4096 jit_wb_if_flag_byteofs = struct.pack(i, 4096).index('\x10') jit_wb_if_flag_singlebyte = 0x10 -jit_wb_cards_set = 8192 -jit_wb_cards_set_byteofs = struct.pack(i, 8192).index('\x20') -jit_wb_cards_set_singlebyte = 0x20 +jit_wb_cards_set = 32768 +jit_wb_cards_set_byteofs = struct.pack(i, 32768).index('\x80') +jit_wb_cards_set_singlebyte = -0x80 jit_wb_card_page_shift = 7 def get_write_barrier_from_array_fn(self, cpu): return funcbox.getint() # -for BoxIndexCls in [BoxInt, ConstInt]: -for cond in [False, True]: +for BoxIndexCls in [BoxInt, ConstInt]*3: +for cond in [-1, 0, 1, 2]: +# cond=-1:GCFLAG_TRACK_YOUNG_PTRS, GCFLAG_CARDS_SET are not set +# cond=0: GCFLAG_CARDS_SET is never set +# cond=1: GCFLAG_CARDS_SET is not set, but the wb sets it +# cond=2: GCFLAG_CARDS_SET is already set print print '_'*79 print 'BoxIndexCls =', BoxIndexCls -print 'JIT_WB_CARDS_SET =', cond +print 'testing cond =', cond print value = random.randrange(-sys.maxint, sys.maxint) -value |= 4096 -
[pypy-commit] pypy default: Fix the test on Linux.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r55284:f94ef1d4068a Date: 2012-06-03 16:10 +0200 http://bitbucket.org/pypy/pypy/changeset/f94ef1d4068a/ Log:Fix the test on Linux. diff --git a/pypy/module/_socket/test/test_sock_app.py b/pypy/module/_socket/test/test_sock_app.py --- a/pypy/module/_socket/test/test_sock_app.py +++ b/pypy/module/_socket/test/test_sock_app.py @@ -618,9 +618,12 @@ except timeout: pass t.recv(count) -# test sendall() timeout, be sure to send data larger than the -# socket buffer -raises(timeout, cli.sendall, 'foobar' * 7000) +# test sendall() timeout +try: +while 1: +cli.sendall('foobar' * 70) +except timeout: +pass # done cli.close() t.close() ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test. The issue is not arg+memo. The issue is that you cannot
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r54315:1da1c1632353 Date: 2012-04-12 17:41 +0200 http://bitbucket.org/pypy/pypy/changeset/1da1c1632353/ Log:Fix the test. The issue is not arg+memo. The issue is that you cannot call the specialize:arg function f with f(i), even if you just did if i == 2 before. diff --git a/pypy/annotation/test/test_annrpython.py b/pypy/annotation/test/test_annrpython.py --- a/pypy/annotation/test/test_annrpython.py +++ b/pypy/annotation/test/test_annrpython.py @@ -3746,9 +3746,9 @@ return g(i) def main(i): if i == 2: -return f(i) +return f(2) elif i == 3: -return f(i) +return f(3) else: raise NotImplementedError ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test: the 'len' attribute is now promoted to the common base
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r54120:27de13d1a9e7 Date: 2012-04-01 16:48 +0200 http://bitbucket.org/pypy/pypy/changeset/27de13d1a9e7/ Log:Fix the test: the 'len' attribute is now promoted to the common base class W_ArrayBase, which is ok. diff --git a/pypy/module/pypyjit/test_pypy_c/test_misc.py b/pypy/module/pypyjit/test_pypy_c/test_misc.py --- a/pypy/module/pypyjit/test_pypy_c/test_misc.py +++ b/pypy/module/pypyjit/test_pypy_c/test_misc.py @@ -212,7 +212,7 @@ i19 = int_add(i12, 1) setfield_gc(p9, i19, descr=FieldS .*W_AbstractSeqIterObject.inst_index .*) guard_nonnull_class(p17, 146982464, descr=...) -i21 = getfield_gc(p17, descr=FieldS .*W_ArrayTypei.inst_len .*) +i21 = getfield_gc(p17, descr=FieldS .*W_Array.*.inst_len .*) i23 = int_lt(0, i21) guard_true(i23, descr=...) i24 = getfield_gc(p17, descr=FieldU .*W_ArrayTypei.inst_buffer .*) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r53114:6f07c52e6ee9 Date: 2012-03-02 16:01 +0100 http://bitbucket.org/pypy/pypy/changeset/6f07c52e6ee9/ Log:Fix the test. diff --git a/pypy/jit/metainterp/test/test_compile.py b/pypy/jit/metainterp/test/test_compile.py --- a/pypy/jit/metainterp/test/test_compile.py +++ b/pypy/jit/metainterp/test/test_compile.py @@ -14,7 +14,7 @@ ts = typesystem.llhelper def __init__(self): self.seen = [] -def compile_loop(self, inputargs, operations, token, name=''): +def compile_loop(self, inputargs, operations, token, log=True, name=''): self.seen.append((inputargs, operations, token)) class FakeLogger(object): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix this test
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r52813:55fd1d7090fb Date: 2012-02-23 18:32 +0100 http://bitbucket.org/pypy/pypy/changeset/55fd1d7090fb/ Log:Fix this test diff --git a/pypy/translator/sandbox/test/test_sandbox.py b/pypy/translator/sandbox/test/test_sandbox.py --- a/pypy/translator/sandbox/test/test_sandbox.py +++ b/pypy/translator/sandbox/test/test_sandbox.py @@ -145,9 +145,9 @@ g = pipe.stdin f = pipe.stdout expect(f, g, ll_os.ll_os_getenv, (PYPY_GENERATIONGC_NURSERY,), None) -if sys.platform.startswith('linux'): # on Mac, uses another (sandboxsafe) approach -expect(f, g, ll_os.ll_os_open, (/proc/cpuinfo, 0, 420), - OSError(5232, xyz)) +#if sys.platform.startswith('linux'): +#expect(f, g, ll_os.ll_os_open, (/proc/cpuinfo, 0, 420), +# OSError(5232, xyz)) expect(f, g, ll_os.ll_os_getenv, (PYPY_GC_DEBUG,), None) g.close() tail = f.read() ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix this test.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r52123:28b333b86328 Date: 2012-02-06 10:16 +0100 http://bitbucket.org/pypy/pypy/changeset/28b333b86328/ Log:Fix this test. diff --git a/pypy/module/pypyjit/test_pypy_c/test_call.py b/pypy/module/pypyjit/test_pypy_c/test_call.py --- a/pypy/module/pypyjit/test_pypy_c/test_call.py +++ b/pypy/module/pypyjit/test_pypy_c/test_call.py @@ -27,6 +27,7 @@ ... p53 = call_assembler(..., descr=...) guard_not_forced(descr=...) +keepalive(...) guard_no_exception(descr=...) ... ) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r51647:7cd209e0414e Date: 2012-01-22 17:29 +0100 http://bitbucket.org/pypy/pypy/changeset/7cd209e0414e/ Log:fix the test. diff --git a/pypy/module/pypyjit/test_pypy_c/test_math.py b/pypy/module/pypyjit/test_pypy_c/test_math.py --- a/pypy/module/pypyjit/test_pypy_c/test_math.py +++ b/pypy/module/pypyjit/test_pypy_c/test_math.py @@ -102,6 +102,7 @@ assert abs(log.result - main(500)) 1e-9 loop, = log.loops_by_filename(self.filepath) assert loop.match_by_id(pow, -f2 = float_mul(f1, f1) -f3 = float_sub(f1, f2) +guard_not_invalidated(descr=...) +f38 = float_mul(f30, f30) +f39 = float_sub(f30, f38) ) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test
Author: Maciej Fijalkowski fij...@gmail.com Branch: Changeset: r51284:20ee6554e580 Date: 2012-01-12 18:26 +0200 http://bitbucket.org/pypy/pypy/changeset/20ee6554e580/ Log:fix the test diff --git a/pypy/jit/metainterp/test/test_ztranslation.py b/pypy/jit/metainterp/test/test_ztranslation.py --- a/pypy/jit/metainterp/test/test_ztranslation.py +++ b/pypy/jit/metainterp/test/test_ztranslation.py @@ -3,7 +3,7 @@ from pypy.jit.backend.llgraph import runner from pypy.rlib.jit import JitDriver, unroll_parameters, set_param from pypy.rlib.jit import PARAMETERS, dont_look_inside, hint -from pypy.rlib.jit_hooks import boxint_new, resop_new, resop_opnum +from pypy.rlib.jit_hooks import boxint_new, resop_new, resop_getopnum from pypy.jit.metainterp.jitprof import Profiler from pypy.jit.metainterp.resoperation import rop from pypy.rpython.lltypesystem import lltype, llmemory @@ -96,7 +96,7 @@ def main(i, j): op = resop_new(rop.INT_ADD, [boxint_new(3), boxint_new(5)], boxint_new(8)) -return f(i) - f2(i+j, i, j) + resop_opnum(op) +return f(i) - f2(i+j, i, j) + resop_getopnum(op) res = ll_meta_interp(main, [40, 5], CPUClass=self.CPUClass, type_system=self.type_system, listops=True) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test
Author: Maciej Fijalkowski fij...@gmail.com Branch: Changeset: r50894:17fd3576a153 Date: 2011-12-27 13:36 +0200 http://bitbucket.org/pypy/pypy/changeset/17fd3576a153/ Log:fix the test diff --git a/pypy/jit/metainterp/test/test_compile.py b/pypy/jit/metainterp/test/test_compile.py --- a/pypy/jit/metainterp/test/test_compile.py +++ b/pypy/jit/metainterp/test/test_compile.py @@ -18,7 +18,7 @@ self.seen.append((inputargs, operations, token)) class FakeLogger(object): -def log_loop(self, inputargs, operations, number=0, type=None, ops_offset=None): +def log_loop(self, inputargs, operations, number=0, type=None, ops_offset=None, name=''): pass def repr_of_resop(self, op): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the test
Author: Maciej Fijalkowski fij...@gmail.com Branch: Changeset: r50899:6d97be67953c Date: 2011-12-27 14:22 +0200 http://bitbucket.org/pypy/pypy/changeset/6d97be67953c/ Log:fix the test diff --git a/pypy/jit/backend/x86/test/test_runner.py b/pypy/jit/backend/x86/test/test_runner.py --- a/pypy/jit/backend/x86/test/test_runner.py +++ b/pypy/jit/backend/x86/test/test_runner.py @@ -552,9 +552,10 @@ self.cpu.finish_once() finally: debug._log = None +l0 = ('debug_print', 'entry -1:1') l1 = ('debug_print', preambletoken.repr_of_descr() + ':1') l2 = ('debug_print', targettoken.repr_of_descr() + ':9') -assert ('jit-backend-counts', [l1, l2]) in dlog +assert ('jit-backend-counts', [l0, l1, l2]) in dlog def test_debugger_checksum(self): loop = ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r50875:cce139c7a9c6 Date: 2011-12-26 15:31 +0100 http://bitbucket.org/pypy/pypy/changeset/cce139c7a9c6/ Log:Fix the test. diff --git a/pypy/translator/generator.py b/pypy/translator/generator.py --- a/pypy/translator/generator.py +++ b/pypy/translator/generator.py @@ -105,12 +105,20 @@ # mappings = [Entry] # +stopblock = Block([]) +v0 = Variable(); v1 = Variable() +stopblock.operations = [ +SpaceOperation('simple_call', [Constant(StopIteration)], v0), +SpaceOperation('type', [v0], v1), +] +stopblock.closeblock(Link([v1, v0], graph.exceptblock)) +# for block in list(graph.iterblocks()): for exit in block.exits: if exit.target is graph.returnblock: -exit.args = [Constant(StopIteration), - Constant(StopIteration())] -exit.target = graph.exceptblock +exit.args = [] +exit.target = stopblock +assert block is not stopblock for index in range(len(block.operations)-1, -1, -1): op = block.operations[index] if op.opname == 'yield': ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r50175:5abc8457062e Date: 2011-12-05 19:05 +0100 http://bitbucket.org/pypy/pypy/changeset/5abc8457062e/ Log:Fix the test. diff --git a/pypy/jit/metainterp/compile.py b/pypy/jit/metainterp/compile.py --- a/pypy/jit/metainterp/compile.py +++ b/pypy/jit/metainterp/compile.py @@ -298,7 +298,7 @@ pass class ResumeGuardDescr(ResumeDescr): -_counter = 0# if 0, there is one counter per value; +_counter = 0# on a GUARD_VALUE, there is one counter per value; _counters = None# they get stored in _counters then. # this class also gets the following attributes stored by resume.py code @@ -309,10 +309,13 @@ rd_virtuals = None rd_pendingfields = lltype.nullptr(PENDINGFIELDSP.TO) -CNT_INT = -0x2000 -CNT_REF = -0x4000 -CNT_FLOAT = -0x6000 -CNT_MASK = 0x1FFF +CNT_BASE_MASK = 0x0FFF # the base counter value +CNT_BUSY_FLAG = 0x1000 # if set, busy tracing from the guard +CNT_TYPE_MASK = 0x6000 # mask for the type + +CNT_INT= 0x2000 +CNT_REF= 0x4000 +CNT_FLOAT = 0x6000 def store_final_boxes(self, guard_op, boxes): guard_op.setfailargs(boxes) @@ -326,6 +329,8 @@ except ValueError: return # xxx probably very rare else: +if i self.CNT_BASE_MASK: +return# probably never, but better safe than sorry if box.type == history.INT: cnt = self.CNT_INT elif box.type == history.REF: @@ -334,14 +339,17 @@ cnt = self.CNT_FLOAT else: assert 0, box.type -# we build the following value for _counter, which is always -# a negative value +assert cnt self.CNT_BASE_MASK self._counter = cnt | i def handle_fail(self, metainterp_sd, jitdriver_sd): if self.must_compile(metainterp_sd, jitdriver_sd): -return self._trace_and_compile_from_bridge(metainterp_sd, - jitdriver_sd) +self.start_compiling() +try: +return self._trace_and_compile_from_bridge(metainterp_sd, + jitdriver_sd) +finally: +self.done_compiling() else: from pypy.jit.metainterp.blackhole import resume_in_blackhole resume_in_blackhole(metainterp_sd, jitdriver_sd, self) @@ -359,12 +367,22 @@ def must_compile(self, metainterp_sd, jitdriver_sd): trace_eagerness = jitdriver_sd.warmstate.trace_eagerness -if self._counter = 0: +# +if self._counter = self.CNT_BASE_MASK: +# simple case: just counting from 0 to trace_eagerness self._counter += 1 return self._counter = trace_eagerness -else: -index = self._counter self.CNT_MASK -typetag = self._counter ~ self.CNT_MASK +# +# do we have the BUSY flag? If so, we're tracing right now, e.g. in an +# outer invocation of the same function, so don't trace again for now. +elif self._counter self.CNT_BUSY_FLAG: +return False +# +else: # we have a GUARD_VALUE that fails. Make a _counters instance +# (only now, when the guard is actually failing at least once), +# and use it to record some statistics about the failing values. +index = self._counter self.CNT_BASE_MASK +typetag = self._counter self.CNT_TYPE_MASK counters = self._counters if typetag == self.CNT_INT: intvalue = metainterp_sd.cpu.get_latest_value_int(index) @@ -391,7 +409,16 @@ assert 0, typetag return counter = trace_eagerness -def reset_counter_from_failure(self): +def start_compiling(self): +# start tracing and compiling from this guard. +self._counter |= self.CNT_BUSY_FLAG + +def done_compiling(self): +# done tracing and compiling from this guard. Either the bridge has +# been successfully compiled, in which case whatever value we store +# in self._counter will not be seen any more, or not, in which case +# we should reset the counter to 0, in order to wait a bit until the +# next attempt. if self._counter = 0: self._counter = 0 self._counters = None @@ -608,9 +635,6 @@ metainterp.set_compiled_merge_points(self.original_greenkey, old_loop_tokens) -def reset_counter_from_failure(self): -pass - def compile_new_bridge(metainterp, old_loop_tokens, resumekey, retraced=False): Try to compile a new bridge leading from the beginning of
[pypy-commit] pypy default: Fix the test.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r49991:b37ba47c5260 Date: 2011-11-30 02:39 +0100 http://bitbucket.org/pypy/pypy/changeset/b37ba47c5260/ Log:Fix the test. diff --git a/pypy/jit/codewriter/effectinfo.py b/pypy/jit/codewriter/effectinfo.py --- a/pypy/jit/codewriter/effectinfo.py +++ b/pypy/jit/codewriter/effectinfo.py @@ -243,11 +243,20 @@ class RandomEffectsAnalyzer(BoolGraphAnalyzer): def analyze_direct_call(self, graph, seen=None): if hasattr(graph, func) and hasattr(graph.func, _ptr): +# the attribute _ptr is stored on the function 'graph.func' +# by rffi.llexternal(). It's a hack... if graph.func._ptr._obj.random_effects_on_gcobjs: return True return super(RandomEffectsAnalyzer, self).analyze_direct_call(graph, seen) +def analyze_external_call(self, op, seen=None): +funcobj = op.args[0].value._obj +if funcobj.random_effects_on_gcobjs: +return True +return super(RandomEffectsAnalyzer, self).analyze_external_call(op, +seen) + def analyze_simple_operation(self, op, graphinfo): return False 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 @@ -245,6 +245,7 @@ wrapper._annspecialcase_ = 'specialize:ll' wrapper._always_inline_ = True # for debugging, stick ll func ptr to that +# (nowadays used in a not-for-debugging way by jit/codewriter/effectinfo) wrapper._ptr = funcptr wrapper = func_with_new_name(wrapper, name) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix this test.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r48638:bfd8b80c9117 Date: 2011-11-01 07:29 + http://bitbucket.org/pypy/pypy/changeset/bfd8b80c9117/ Log:Fix this test. diff --git a/pypy/module/array/test/test_array.py b/pypy/module/array/test/test_array.py --- a/pypy/module/array/test/test_array.py +++ b/pypy/module/array/test/test_array.py @@ -835,7 +835,7 @@ a.append(3.0) r = weakref.ref(a, lambda a: l.append(a())) del a -gc.collect() +gc.collect(); gc.collect() # XXX needs two of them right now... assert l assert l[0] is None or len(l[0]) == 0 ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test for 32-bit machines
Author: Alex Gaynor alex.gay...@gmail.com Branch: Changeset: r48597:753627dbee28 Date: 2011-10-29 02:14 -0400 http://bitbucket.org/pypy/pypy/changeset/753627dbee28/ Log:fix this test for 32-bit machines diff --git a/pypy/module/pypyjit/test_pypy_c/test_containers.py b/pypy/module/pypyjit/test_pypy_c/test_containers.py --- a/pypy/module/pypyjit/test_pypy_c/test_containers.py +++ b/pypy/module/pypyjit/test_pypy_c/test_containers.py @@ -93,7 +93,7 @@ p15 = new_array(8, descr=dictentryArrayDescr) setfield_gc(p13, p15, descr=GcPtrFieldDescr dicttable.entries .*) i17 = call(ConstClass(ll_dict_lookup_trampoline), p13, p10, i12, descr=SignedCallDescr) -setfield_gc(p13, 16, descr=SignedFieldDescr dicttable.resize_counter 16) +setfield_gc(p13, 16, descr=SignedFieldDescr dicttable.resize_counter .*) guard_no_exception(descr=...) p20 = new_with_vtable(ConstClass(W_IntObject)) call(ConstClass(_ll_dict_setitem_lookup_done_trampoline), p13, p10, p20, i12, i17, descr=VoidCallDescr) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test
Author: Alex Gaynor alex.gay...@gmail.com Branch: Changeset: r48534:de9715d6219f Date: 2011-10-27 13:58 -0400 http://bitbucket.org/pypy/pypy/changeset/de9715d6219f/ Log:fix this test diff --git a/pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py b/pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py --- a/pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py +++ b/pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py @@ -4206,10 +4206,12 @@ class FakeCallInfoCollection: def callinfo_for_oopspec(self, oopspecindex): calldescrtype = type(LLtypeMixin.strequaldescr) +effectinfotype = type(LLtypeMixin.strequaldescr.get_extra_info()) for value in LLtypeMixin.__dict__.values(): if isinstance(value, calldescrtype): extra = value.get_extra_info() -if extra and extra.oopspecindex == oopspecindex: +if (extra and isinstance(extra, effectinfotype) and +extra.oopspecindex == oopspecindex): # returns 0 for 'func' in this test return value, 0 raise AssertionError(not found: oopspecindex=%d % diff --git a/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py --- a/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py +++ b/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py @@ -5800,10 +5800,12 @@ class FakeCallInfoCollection: def callinfo_for_oopspec(self, oopspecindex): calldescrtype = type(LLtypeMixin.strequaldescr) +effectinfotype = type(LLtypeMixin.strequaldescr.get_extra_info()) for value in LLtypeMixin.__dict__.values(): if isinstance(value, calldescrtype): extra = value.get_extra_info() -if extra and extra.oopspecindex == oopspecindex: +if (extra and isinstance(extra, effectinfotype) and +extra.oopspecindex == oopspecindex): # returns 0 for 'func' in this test return value, 0 raise AssertionError(not found: oopspecindex=%d % ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix a test in test_optimizebasic, a bit obscurely.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r48111:2bda02052847 Date: 2011-10-17 09:56 +0200 http://bitbucket.org/pypy/pypy/changeset/2bda02052847/ Log:Fix a test in test_optimizebasic, a bit obscurely. diff --git a/pypy/jit/metainterp/resoperation.py b/pypy/jit/metainterp/resoperation.py --- a/pypy/jit/metainterp/resoperation.py +++ b/pypy/jit/metainterp/resoperation.py @@ -431,11 +431,11 @@ 'INT_IS_TRUE/1b', 'INT_NEG/1', 'INT_INVERT/1', +# +'SAME_AS/1', # gets a Const or a Box, turns it into another Box 'CAST_PTR_TO_INT/1', 'CAST_INT_TO_PTR/1', # -'SAME_AS/1', # gets a Const or a Box, turns it into another Box -# 'PTR_EQ/2b', 'PTR_NE/2b', 'CAST_OPAQUE_PTR/1b', ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test. Add in the graphpage viewer shading in gray the
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r48117:849075adda3f Date: 2011-10-17 11:43 +0200 http://bitbucket.org/pypy/pypy/changeset/849075adda3f/ Log:Fix the test. Add in the graphpage viewer shading in gray the invalidated loops. diff --git a/pypy/jit/metainterp/graphpage.py b/pypy/jit/metainterp/graphpage.py --- a/pypy/jit/metainterp/graphpage.py +++ b/pypy/jit/metainterp/graphpage.py @@ -12,8 +12,8 @@ def get_display_text(self): return None -def display_loops(loops, errmsg=None, highlight_loops=()): -graphs = [(loop, loop in highlight_loops) for loop in loops] +def display_loops(loops, errmsg=None, highlight_loops={}): +graphs = [(loop, highlight_loops.get(loop, 0)) for loop in loops] for graph, highlight in graphs: for op in graph.get_operations(): if is_interesting_guard(op): @@ -65,8 +65,7 @@ def add_graph(self, graph, highlight=False): graphindex = len(self.graphs) self.graphs.append(graph) -if highlight: -self.highlight_graphs[graph] = True +self.highlight_graphs[graph] = highlight for i, op in enumerate(graph.get_operations()): self.all_operations[op] = graphindex, i @@ -126,10 +125,13 @@ self.dotgen.emit('subgraph cluster%d {' % graphindex) label = graph.get_display_text() if label is not None: -if self.highlight_graphs.get(graph): -fillcolor = '#f084c2' +colorindex = self.highlight_graphs.get(graph, 0) +if colorindex == 1: +fillcolor = '#f084c2'# highlighted graph +elif colorindex == 2: +fillcolor = '#808080'# invalidated graph else: -fillcolor = '#84f0c2' +fillcolor = '#84f0c2'# normal color self.dotgen.emit_node(graphname, shape=octagon, label=label, fillcolor=fillcolor) self.pendingedges.append((graphname, diff --git a/pypy/jit/metainterp/history.py b/pypy/jit/metainterp/history.py --- a/pypy/jit/metainterp/history.py +++ b/pypy/jit/metainterp/history.py @@ -732,6 +732,7 @@ failed_states = None retraced_count = 0 terminating = False # see TerminatingLoopToken in compile.py +invalidated = False outermost_jitdriver_sd = None # and more data specified by the backend when the loop is compiled number = -1 @@ -934,6 +935,7 @@ self.loops = [] self.locations = [] self.aborted_keys = [] +self.invalidated_token_numbers = set() def set_history(self, history): self.operations = history.operations @@ -1012,7 +1014,12 @@ if loop in loops: loops.remove(loop) loops.append(loop) -display_loops(loops, errmsg, extraloops) +highlight_loops = dict.fromkeys(extraloops, 1) +for loop in loops: +if hasattr(loop, '_looptoken_number') and ( +loop._looptoken_number in self.invalidated_token_numbers): +highlight_loops.setdefault(loop, 2) +display_loops(loops, errmsg, highlight_loops) # diff --git a/pypy/jit/metainterp/quasiimmut.py b/pypy/jit/metainterp/quasiimmut.py --- a/pypy/jit/metainterp/quasiimmut.py +++ b/pypy/jit/metainterp/quasiimmut.py @@ -2,6 +2,7 @@ from pypy.rpython.lltypesystem import lltype, rclass from pypy.rpython.annlowlevel import cast_base_ptr_to_instance from pypy.jit.metainterp.history import AbstractDescr +from pypy.rlib.objectmodel import we_are_translated def get_mutate_field_name(fieldname): @@ -73,8 +74,12 @@ self.looptokens_wrefs.append(wref_looptoken) def compress_looptokens_list(self): -self.looptokens_wrefs = [wref for wref in self.looptokens_wrefs - if wref() is not None] +newlist = [] +for wref in self.looptokens_wrefs: +looptoken = wref() +if looptoken is not None and not looptoken.invalidated: +newlist.append(wref) +self.looptokens_wrefs = wref self.compress_limit = (len(self.looptokens_wrefs) + 15) * 2 def invalidate(self): @@ -85,8 +90,12 @@ self.looptokens_wrefs = [] for wref in wrefs: looptoken = wref() -if looptoken is not None: +if looptoken is not None and not looptoken.invalidated: +looptoken.invalidated = True self.cpu.invalidate_loop(looptoken) +if not we_are_translated(): +self.cpu.stats.invalidated_token_numbers.add( +looptoken.number) class QuasiImmutDescr(AbstractDescr): diff --git a/pypy/jit/metainterp/test/test_quasiimmut.py b/pypy/jit/metainterp/test/test_quasiimmut.py ---
[pypy-commit] pypy default: Fix the test: calling sleep() may not release the GIL before translation.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r48085:6048a0bf9e33 Date: 2011-10-16 16:13 +0200 http://bitbucket.org/pypy/pypy/changeset/6048a0bf9e33/ Log:Fix the test: calling sleep() may not release the GIL before translation. diff --git a/pypy/module/sys/test/test_sysmodule.py b/pypy/module/sys/test/test_sysmodule.py --- a/pypy/module/sys/test/test_sysmodule.py +++ b/pypy/module/sys/test/test_sysmodule.py @@ -568,20 +568,22 @@ import thread thread_id = thread.get_ident() -self.ready = False def other_thread(): -self.ready = True print thread started -time.sleep(5) +lock2.release() +lock1.acquire() +lock1 = thread.allocate_lock() +lock2 = thread.allocate_lock() +lock1.acquire() +lock2.acquire() thread.start_new_thread(other_thread, ()) def f(): -for i in range(100): -if self.ready: break -time.sleep(0.1) +lock2.acquire() return sys._current_frames() frames = f() +lock1.release() thisframe = frames.pop(thread_id) assert thisframe.f_code.co_name == 'f' ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test. This is mostly covering for an issue with
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r48073:659180bd3030 Date: 2011-10-15 14:56 +0200 http://bitbucket.org/pypy/pypy/changeset/659180bd3030/ Log:Fix the test. This is mostly covering for an issue with jit.isconstant(), but it is known. diff --git a/pypy/rlib/test/test_jit.py b/pypy/rlib/test/test_jit.py --- a/pypy/rlib/test/test_jit.py +++ b/pypy/rlib/test/test_jit.py @@ -139,12 +139,11 @@ def test_isconstant(self): def f(n): -assert n = 0 assert isconstant(n) is False l = [] l.append(n) return len(l) -res = self.interpret(f, [234]) +res = self.interpret(f, [-234]) assert res == 1 ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix this test on 64-bit: avoids that random unrelated operations
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r47102:a41ea5a18e1c Date: 2011-09-06 13:36 +0200 http://bitbucket.org/pypy/pypy/changeset/a41ea5a18e1c/ Log:Fix this test on 64-bit: avoids that random unrelated operations show up here, by adding a dummy getattr previously in the loop. diff --git a/pypy/module/pypyjit/test_pypy_c/test_instance.py b/pypy/module/pypyjit/test_pypy_c/test_instance.py --- a/pypy/module/pypyjit/test_pypy_c/test_instance.py +++ b/pypy/module/pypyjit/test_pypy_c/test_instance.py @@ -142,6 +142,7 @@ i = 0 b = B(1) while i 100: +b.x v = b.x # ID: loadattr i += v return i @@ -150,8 +151,6 @@ loop, = log.loops_by_filename(self.filepath) assert loop.match_by_id('loadattr', ''' -guard_not_invalidated(descr=...) -i16 = arraylen_gc(p10, descr=GcPtrArrayDescr) i19 = call(ConstClass(ll_dict_lookup), _, _, _, descr=...) guard_no_exception(descr=...) i21 = int_and(i19, _) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix a test I broke, by better optimizing things :)
Author: Alex Gaynor alex.gay...@gmail.com Branch: Changeset: r47028:43ff84065e19 Date: 2011-09-02 11:21 -0400 http://bitbucket.org/pypy/pypy/changeset/43ff84065e19/ Log:Fix a test I broke, by better optimizing things :) diff --git a/pypy/module/pypyjit/test_pypy_c/test_instance.py b/pypy/module/pypyjit/test_pypy_c/test_instance.py --- a/pypy/module/pypyjit/test_pypy_c/test_instance.py +++ b/pypy/module/pypyjit/test_pypy_c/test_instance.py @@ -181,8 +181,7 @@ assert loop.match_by_id(contains, guard_not_invalidated(descr=...) i11 = force_token() -i12 = int_add_ovf(i5, i7) -guard_no_overflow(descr=...) +i12 = int_add(i5, 1) ) def test_id_compare_optimization(self): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix a test.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r46949:efaa417ebadc Date: 2011-08-31 17:19 +0200 http://bitbucket.org/pypy/pypy/changeset/efaa417ebadc/ Log:Fix a test. diff --git a/pypy/jit/metainterp/warmstate.py b/pypy/jit/metainterp/warmstate.py --- a/pypy/jit/metainterp/warmstate.py +++ b/pypy/jit/metainterp/warmstate.py @@ -124,7 +124,7 @@ # Hash of lltype or ootype object. # Only supports strings, unicodes and regular instances, # as well as primitives that can meaningfully be cast to Signed. -if isinstance(TYPE, lltype.Ptr): +if isinstance(TYPE, lltype.Ptr) and TYPE.TO._gckind == 'gc': if TYPE.TO is rstr.STR or TYPE.TO is rstr.UNICODE: return rstr.LLHelpers.ll_strhash(x)# assumed not null else: @@ -140,7 +140,7 @@ else: return 0 else: -return lltype.cast_primitive(lltype.Signed, x) +return rffi.cast(lltype.Signed, x) @specialize.ll_and_arg(3) def set_future_value(cpu, j, value, typecode): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix this test.
Author: Alex Gaynor alex.gay...@gmail.com Branch: Changeset: r46873:4cb1cf2c1496 Date: 2011-08-28 18:02 -0400 http://bitbucket.org/pypy/pypy/changeset/4cb1cf2c1496/ Log:fix this test. diff --git a/pypy/module/pypyjit/test_pypy_c/test_math.py b/pypy/module/pypyjit/test_pypy_c/test_math.py --- a/pypy/module/pypyjit/test_pypy_c/test_math.py +++ b/pypy/module/pypyjit/test_pypy_c/test_math.py @@ -78,6 +78,7 @@ assert loop.match( i1 = int_gt(i0, 0) guard_true(i1, descr=...) +guard_not_invalidated(descr=...) f1 = cast_int_to_float(i0) i2 = float_eq(f1, inf) i3 = float_eq(f1, -inf) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test by properly detecting the case during codewriting,
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r46682:e5fb197506d6 Date: 2011-08-21 11:31 +0200 http://bitbucket.org/pypy/pypy/changeset/e5fb197506d6/ Log:Fix the test by properly detecting the case during codewriting, and raising NotImplementedError. diff --git a/pypy/jit/codewriter/jtransform.py b/pypy/jit/codewriter/jtransform.py --- a/pypy/jit/codewriter/jtransform.py +++ b/pypy/jit/codewriter/jtransform.py @@ -571,6 +571,7 @@ pure = '_pure' else: pure = '' +self.check_field_access(v_inst.concretetype.TO) argname = getattr(v_inst.concretetype.TO, '_gckind', 'gc') descr = self.cpu.fielddescrof(v_inst.concretetype.TO, c_fieldname.value) @@ -604,6 +605,7 @@ return [SpaceOperation('-live-', [], None), SpaceOperation('setfield_vable_%s' % kind, [v_inst, descr, v_value], None)] +self.check_field_access(v_inst.concretetype.TO) argname = getattr(v_inst.concretetype.TO, '_gckind', 'gc') descr = self.cpu.fielddescrof(v_inst.concretetype.TO, c_fieldname.value) @@ -616,6 +618,22 @@ return (op.args[1].value == 'typeptr' and op.args[0].concretetype.TO._hints.get('typeptr')) +def check_field_access(self, STRUCT): +# check against a GcStruct with a nested GcStruct as a first argument +# but which is not an object at all; see metainterp/test/test_loop, +# test_regular_pointers_in_short_preamble. +if not isinstance(STRUCT, lltype.GcStruct): +return +if STRUCT._first_struct() == (None, None): +return +PARENT = STRUCT +while not PARENT._hints.get('typeptr'): +_, PARENT = PARENT._first_struct() +if PARENT is None: +raise NotImplementedError(%r is a GcStruct using nesting but + not inheriting from object % + (STRUCT,)) + def get_vinfo(self, v_virtualizable): if self.callcontrol is None: # for tests return None diff --git a/pypy/jit/codewriter/test/test_jtransform.py b/pypy/jit/codewriter/test/test_jtransform.py --- a/pypy/jit/codewriter/test/test_jtransform.py +++ b/pypy/jit/codewriter/test/test_jtransform.py @@ -1014,3 +1014,13 @@ assert op1.opname == 'jit_force_quasi_immutable' assert op1.args[0] == v_x assert op1.args[1] == ('fielddescr', STRUCT, 'mutate_x') + +def test_no_gcstruct_nesting_outside_of_OBJECT(): +PARENT = lltype.GcStruct('parent') +STRUCT = lltype.GcStruct('struct', ('parent', PARENT), + ('x', lltype.Signed)) +v_x = varoftype(lltype.Ptr(STRUCT)) +op = SpaceOperation('getfield', [v_x, Constant('x', lltype.Void)], +varoftype(lltype.Signed)) +tr = Transformer(None, None) +raises(NotImplementedError, tr.rewrite_operation, op) diff --git a/pypy/jit/metainterp/test/test_loop.py b/pypy/jit/metainterp/test/test_loop.py --- a/pypy/jit/metainterp/test/test_loop.py +++ b/pypy/jit/metainterp/test/test_loop.py @@ -801,8 +801,6 @@ res = self.meta_interp(f, [200]) def test_regular_pointers_in_short_preamble(self): -# XXX do we really care about this case? If not, we should -# at least detect it and complain during codewriter/jtransform from pypy.rpython.lltypesystem import lltype BASE = lltype.GcStruct('BASE') A = lltype.GcStruct('A', ('parent', BASE), ('val', lltype.Signed)) @@ -829,9 +827,8 @@ assert n0 and m0 i += j return sa -expected = f(20, 10, 1) -res = self.meta_interp(f, [20, 10, 1]) -assert res == expected +# This is detected as invalid by the codewriter, for now +py.test.raises(NotImplementedError, self.meta_interp, f, [20, 10, 1]) def test_unerased_pointers_in_short_preamble(self): from pypy.rlib.rerased import new_erasing_pair ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix this test.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r46236:3a789ffe42d2 Date: 2011-08-03 10:03 +0200 http://bitbucket.org/pypy/pypy/changeset/3a789ffe42d2/ Log:Fix this test. diff --git a/pypy/module/pypyjit/test_pypy_c/test_string.py b/pypy/module/pypyjit/test_pypy_c/test_string.py --- a/pypy/module/pypyjit/test_pypy_c/test_string.py +++ b/pypy/module/pypyjit/test_pypy_c/test_string.py @@ -90,12 +90,12 @@ i46 = call(ConstClass(ll_startswith__rpy_stringPtr_rpy_stringPtr), p28, ConstPtr(ptr45), descr=BoolCallDescr) guard_false(i46, descr=...) p51 = new_with_vtable(21136408) -setfield_gc(p51, p28, descr=GcPtrFieldDescr .*NumberStringParser.inst_literal .*) -setfield_gc(p51, ConstPtr(ptr51), descr=GcPtrFieldDescr pypy.objspace.std.strutil.NumberStringParser.inst_fname .*) -setfield_gc(p51, 1, descr=SignedFieldDescr .*NumberStringParser.inst_sign .*) -setfield_gc(p51, 16, descr=SignedFieldDescr .*NumberStringParser.inst_base .*) -setfield_gc(p51, p28, descr=GcPtrFieldDescr .*NumberStringParser.inst_s .*) -setfield_gc(p51, i29, descr=SignedFieldDescr .*NumberStringParser.inst_n .*) +setfield_gc(p51, _, descr=...)# 6 setfields, but the order is dict-order-dependent +setfield_gc(p51, _, descr=...) +setfield_gc(p51, _, descr=...) +setfield_gc(p51, _, descr=...) +setfield_gc(p51, _, descr=...) +setfield_gc(p51, _, descr=...) p55 = call(ConstClass(parse_digit_string), p51, descr=GcPtrCallDescr) guard_no_exception(descr=...) i57 = call(ConstClass(rbigint.toint), p55, descr=SignedCallDescr) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit