Author: Carl Friedrich Bolz <[email protected]>
Branch:
Changeset: r88755:e30a24ad4ccd
Date: 2016-11-29 17:54 +0100
http://bitbucket.org/pypy/pypy/changeset/e30a24ad4ccd/
Log: unspotted copy-paste mistake in descroperation, fix error message if
__oct__, __repr__, __hex__ return a non-string
diff --git a/pypy/objspace/descroperation.py b/pypy/objspace/descroperation.py
--- a/pypy/objspace/descroperation.py
+++ b/pypy/objspace/descroperation.py
@@ -853,7 +853,7 @@
if not e.match(space, space.w_TypeError):
raise
raise oefmt(space.w_TypeError,
- "%(specialname)s returned non-%(targetname)s "
+ "%(specialname)s returned non-string "
"(type '%%T')", w_result)
else:
# re-wrap the result as a real string
diff --git a/pypy/objspace/test/test_descroperation.py
b/pypy/objspace/test/test_descroperation.py
--- a/pypy/objspace/test/test_descroperation.py
+++ b/pypy/objspace/test/test_descroperation.py
@@ -315,7 +315,8 @@
assert operate(A()) == "world" * n
assert type(operate(A())) is str
answer = 42
- raises(TypeError, operate, A())
+ excinfo = raises(TypeError, operate, A())
+ assert "returned non-string (type 'int')" in str(excinfo.value)
def test_missing_getattribute(self):
class X(object):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit