[pypy-commit] pypy default: Test and fix.

arigo noreply at buildbot.pypy.org
Fri Nov 25 17:56:51 CET 2011

Author: Armin Rigo <arigo at tunes.org>
Changeset: r49795:41640216dae5
Date: 2011-11-25 17:56 +0100

Log:	Test and fix.

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,7 +1,7 @@
 import py
 from pypy.interpreter.baseobjspace import Wrappable, W_Root
 from pypy.interpreter.error import OperationError
-from pypy.interpreter.gateway import interp2app, ObjSpace, NoneNotWrapped
+from pypy.interpreter.gateway import interp2app, ObjSpace
 from pypy.interpreter.typedef import TypeDef
 from pypy.rlib import jit
 import weakref
@@ -294,11 +294,11 @@
     lifeline = getlifelinewithcallbacks(space, w_obj)
     return lifeline.make_proxy_with_callback(w_obj, w_callable)
-def proxy(space, w_obj, w_callable=NoneNotWrapped):
+def proxy(space, w_obj, w_callable=None):
     """Create a proxy object that weakly references 'obj'.
 'callback', if given, is called with the proxy as an argument when 'obj'
 is about to be finalized."""
-    if w_callable is None:
+    if space.is_w(w_callable, space.w_None):
         return get_or_make_proxy(space, w_obj)
         return make_proxy_with_callback(space, w_obj, w_callable)
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
@@ -324,6 +324,7 @@
         class A(object): pass
         a = A()
         assert _weakref.proxy(a) is _weakref.proxy(a)
+        assert _weakref.proxy(a) is _weakref.proxy(a, None)
     def test_callable_proxy(self):
         import _weakref, gc

More information about the pypy-commit mailing list