Author: Amaury Forgeot d'Arc <amaur...@gmail.com> Branch: py3k Changeset: r50674:e8bdadce915a Date: 2011-12-18 19:33 +0100 http://bitbucket.org/pypy/pypy/changeset/e8bdadce915a/
Log: hg merge default diff --git a/pypy/module/_weakref/interp__weakref.py b/pypy/module/_weakref/interp__weakref.py --- a/pypy/module/_weakref/interp__weakref.py +++ b/pypy/module/_weakref/interp__weakref.py @@ -329,11 +329,16 @@ special_ops = {'repr': True, 'userdel': True, 'hash': True} for opname, _, arity, special_methods in ObjSpace.MethodTable: - if opname in special_ops: + if opname in special_ops or not special_methods: continue nonspaceargs = ", ".join(["w_obj%s" % i for i in range(arity)]) code = "def func(space, %s):\n '''%s'''\n" % (nonspaceargs, opname) - for i in range(arity): + assert arity >= len(special_methods) + forcing_count = len(special_methods) + if opname.startswith('inplace_'): + assert arity == 2 + forcing_count = arity + for i in range(forcing_count): code += " w_obj%s = force(space, w_obj%s)\n" % (i, i) code += " return space.%s(%s)" % (opname, nonspaceargs) exec py.code.Source(code).compile() diff --git a/pypy/module/_weakref/test/test_weakref.py b/pypy/module/_weakref/test/test_weakref.py --- a/pypy/module/_weakref/test/test_weakref.py +++ b/pypy/module/_weakref/test/test_weakref.py @@ -466,3 +466,44 @@ # No exception should be raised here gc.collect() + def test_add(self): + import _weakref + class A(object): + def __add__(self, other): + return other + a1 = A() + a2 = A() + p1 = _weakref.proxy(a1) + p2 = _weakref.proxy(a2) + a3 = p1 + p2 + assert a3 is a2 + + def test_inplace_add(self): + import _weakref + class A(object): + def __add__(self, other): + return other + a1 = A() + a2 = A() + p1 = _weakref.proxy(a1) + p2 = _weakref.proxy(a2) + p1 += p2 + assert p1 is a2 + + def test_setattr(self): + import _weakref + class A(object): + def __setitem__(self, key, value): + self.setkey = key + self.setvalue = value + a1 = A() + a2 = A() + p1 = _weakref.proxy(a1) + p2 = _weakref.proxy(a2) + p1[p2] = 42 + assert a1.setkey is p2 + assert a1.setvalue == 42 + # + p1[42] = p2 + assert a1.setkey == 42 + assert a1.setvalue is p2 diff --git a/pypy/module/micronumpy/app_numpy.py b/pypy/module/micronumpy/app_numpy.py --- a/pypy/module/micronumpy/app_numpy.py +++ b/pypy/module/micronumpy/app_numpy.py @@ -53,7 +53,6 @@ i = start for j in range(arr.size): arr[j] = i - j += 1 i += step return arr diff --git a/pypy/module/pypyjit/test_pypy_c/test_generators.py b/pypy/module/pypyjit/test_pypy_c/test_generators.py --- a/pypy/module/pypyjit/test_pypy_c/test_generators.py +++ b/pypy/module/pypyjit/test_pypy_c/test_generators.py @@ -17,13 +17,6 @@ g() log = self.run(main, [500]) - # XXX XXX this test fails so far because of a detail that - # changed with jit-simplify-backendintf. We should try to - # think of a way to be more resistent against such details. - # The issue is that we now get one Tracing, then go back - # to the interpreter hoping to immediately run the JITted - # code; but instead, we Trace again, just because another - # counter was also about to reach its limit... loop, = log.loops_by_filename(self.filepath) assert loop.match_by_id("generator", """ i16 = force_token() @@ -34,7 +27,7 @@ jump(..., descr=...) """) assert loop.match_by_id("subtract", """ - setfield_gc(p7, 35, descr=<.*last_instr .*>) # XXX bad, kill me + setfield_gc(p7, 35, descr=<.*last_instr .*>) # XXX bad, kill me i2 = int_sub_ovf(i1, 42) guard_no_overflow(descr=...) """) diff --git a/pypy/tool/gcc_cache.py b/pypy/tool/gcc_cache.py --- a/pypy/tool/gcc_cache.py +++ b/pypy/tool/gcc_cache.py @@ -11,9 +11,6 @@ # Import 'platform' every time, the compiler may have been changed from pypy.translator.platform import platform cache_dir = cache_dir_root.join(cachename).ensure(dir=1) - c_files.extend([py.path.local(f) for f in eci.separate_module_files]) - eci = ExternalCompilationInfo(**eci._copy_attributes()) - eci.separate_module_files = () filecontents = [c_file.read() for c_file in c_files] key = repr((filecontents, eci, platform.key())) hash = md5(key).hexdigest() _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit