Author: Armin Rigo <[email protected]>
Branch: fix-descrmismatch-crash
Changeset: r97773:cc73504e9f94
Date: 2019-10-14 11:48 +0200
http://bitbucket.org/pypy/pypy/changeset/cc73504e9f94/
Log: same fix for weakref-or-proxy
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
@@ -156,6 +156,8 @@
class W_WeakrefBase(W_Root):
+ exact_class_applevel_name = 'weakref-or-proxy'
+
def __init__(self, space, w_obj, w_callable):
assert w_callable is not space.w_None # should be really None
self.space = space
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
@@ -543,3 +543,12 @@
p1[42] = p2
assert a1.setkey == 42
assert a1.setvalue is p2
+
+ def test_error_message_wrong_self(self):
+ import _weakref
+ unboundmeth = _weakref.ref.__repr__
+ e = raises(TypeError, unboundmeth, 42)
+ assert "weakref" in str(e.value)
+ if hasattr(unboundmeth, 'im_func'):
+ e = raises(TypeError, unboundmeth.im_func, 42)
+ assert "'weakref-or-proxy'" in str(e.value)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit