Author: Hakan Ardo <ha...@debian.org> Branch: Changeset: r44365:72790846754e Date: 2011-05-22 10:21 +0200 http://bitbucket.org/pypy/pypy/changeset/72790846754e/
Log: hg merge 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 @@ -1,9 +1,10 @@ import py +from pypy.interpreter.argument import Arguments from pypy.interpreter.baseobjspace import Wrappable, W_Root -from pypy.interpreter.argument import Arguments from pypy.interpreter.error import OperationError +from pypy.interpreter.gateway import interp2app, ObjSpace from pypy.interpreter.typedef import GetSetProperty, TypeDef -from pypy.interpreter.gateway import interp2app, ObjSpace +from pypy.rlib import jit import weakref @@ -13,7 +14,7 @@ self.refs_weak = [] self.cached_weakref_index = -1 self.cached_proxy_index = -1 - + def __del__(self): """This runs when the interp-level object goes away, and allows its lifeline to go away. The purpose of this is to activate the @@ -37,6 +38,7 @@ # weakref callbacks are not invoked eagerly here. They are # invoked by self.__del__() anyway. + @jit.dont_look_inside def get_or_make_weakref(self, space, w_subtype, w_obj, w_callable): w_weakreftype = space.gettypeobject(W_Weakref.typedef) is_weakreftype = space.is_w(w_weakreftype, w_subtype) @@ -55,6 +57,7 @@ self.cached_weakref_index = index return w_ref + @jit.dont_look_inside def get_or_make_proxy(self, space, w_obj, w_callable): can_reuse = space.is_w(w_callable, space.w_None) if can_reuse and self.cached_proxy_index >= 0: @@ -81,7 +84,7 @@ w_weakreftype = space.gettypeobject(W_Weakref.typedef) for i in range(len(self.refs_weak)): w_ref = self.refs_weak[i]() - if (w_ref is not None and + if (w_ref is not None and space.is_true(space.isinstance(w_ref, w_weakreftype))): return w_ref return space.w_None @@ -106,6 +109,7 @@ w_self.w_obj_weak = weakref.ref(w_obj) w_self.w_callable = w_callable + @jit.dont_look_inside def dereference(self): w_obj = self.w_obj_weak() return w_obj @@ -244,7 +248,7 @@ lifeline = w_obj.getweakref() if lifeline is None: lifeline = WeakrefLifeline(space) - w_obj.setweakref(space, lifeline) + w_obj.setweakref(space, lifeline) return lifeline.get_or_make_proxy(space, w_obj, w_callable) def descr__new__proxy(space, w_subtype, w_obj, w_callable=None): diff --git a/pypy/module/pypyjit/policy.py b/pypy/module/pypyjit/policy.py --- a/pypy/module/pypyjit/policy.py +++ b/pypy/module/pypyjit/policy.py @@ -14,7 +14,7 @@ modname, _ = modname.split('.', 1) if modname in ['pypyjit', 'signal', 'micronumpy', 'math', 'exceptions', 'imp', 'sys', 'array', '_ffi', 'itertools', 'operator', - 'posix', '_socket', '_sre', '_lsprof']: + 'posix', '_socket', '_sre', '_lsprof', '_weakref']: return True return False _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit