Author: Armin Rigo <[email protected]>
Branch: fix-descrmismatch-crash
Changeset: r97775:c2572a2d1270
Date: 2019-10-14 11:59 +0200
http://bitbucket.org/pypy/pypy/changeset/c2572a2d1270/
Log: Some more cases of W_AbstractXxx but where the test already passes
diff --git a/pypy/objspace/std/test/test_intobject.py
b/pypy/objspace/std/test/test_intobject.py
--- a/pypy/objspace/std/test/test_intobject.py
+++ b/pypy/objspace/std/test/test_intobject.py
@@ -684,6 +684,15 @@
x = int(-sys.maxint)
assert x.__rsub__(2) == (2 + sys.maxint)
+ def test_error_message_wrong_self(self):
+ unboundmeth = int.__str__
+ e = raises(TypeError, unboundmeth, "!")
+ assert "int" in str(e.value)
+ if hasattr(unboundmeth, 'im_func'):
+ e = raises(TypeError, unboundmeth.im_func, "!")
+ assert "'int'" in str(e.value)
+
+
class AppTestIntShortcut(AppTestInt):
spaceconfig = {"objspace.std.intshortcut": True}
diff --git a/pypy/objspace/std/test/test_longobject.py
b/pypy/objspace/std/test/test_longobject.py
--- a/pypy/objspace/std/test/test_longobject.py
+++ b/pypy/objspace/std/test/test_longobject.py
@@ -450,3 +450,10 @@
expected = (2 << (size * 4)) // 3
assert long(n, 16) == expected
+ def test_error_message_wrong_self(self):
+ unboundmeth = long.__str__
+ e = raises(TypeError, unboundmeth, 42)
+ assert "long" in str(e.value)
+ if hasattr(unboundmeth, 'im_func'):
+ e = raises(TypeError, unboundmeth.im_func, 42)
+ assert "'long'" in str(e.value)
diff --git a/pypy/objspace/std/test/test_tupleobject.py
b/pypy/objspace/std/test/test_tupleobject.py
--- a/pypy/objspace/std/test/test_tupleobject.py
+++ b/pypy/objspace/std/test/test_tupleobject.py
@@ -454,3 +454,11 @@
(4.1, 2.3), (3.6, 4.8)]
assert specialized_zip_2_lists(["foo", "bar"], [6, 2]) == [
("foo", 6), ("bar", 2)]
+
+ def test_error_message_wrong_self(self):
+ unboundmeth = tuple.__hash__
+ e = raises(TypeError, unboundmeth, 42)
+ assert "tuple" in str(e.value)
+ if hasattr(unboundmeth, 'im_func'):
+ e = raises(TypeError, unboundmeth.im_func, 42)
+ assert "'tuple'" in str(e.value)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit