Author: Carl Friedrich Bolz-Tereick <[email protected]>
Branch: py3.6
Changeset: r97211:6d08856e48f3
Date: 2019-08-18 13:19 +0200
http://bitbucket.org/pypy/pypy/changeset/6d08856e48f3/
Log: adopt changes in BaseException.__repr__
diff --git a/pypy/module/exceptions/interp_exceptions.py
b/pypy/module/exceptions/interp_exceptions.py
--- a/pypy/module/exceptions/interp_exceptions.py
+++ b/pypy/module/exceptions/interp_exceptions.py
@@ -150,8 +150,11 @@
def descr_repr(self, space):
if self.args_w:
- args_repr = space.utf8_w(
- space.repr(space.newtuple(self.args_w)))
+ if len(self.args_w) == 1:
+ args_repr = b"(%s)" %
(space.utf8_w(space.repr(self.args_w[0])), )
+ else:
+ args_repr = space.utf8_w(
+ space.repr(space.newtuple(self.args_w)))
else:
args_repr = b"()"
clsname = self.getclass(space).getname(space)
diff --git a/pypy/module/exceptions/test/test_exc.py
b/pypy/module/exceptions/test/test_exc.py
--- a/pypy/module/exceptions/test/test_exc.py
+++ b/pypy/module/exceptions/test/test_exc.py
@@ -10,7 +10,7 @@
assert repr(BaseException()) == 'BaseException()'
raises(AttributeError, getattr, BaseException(), 'message')
raises(AttributeError, getattr, BaseException(3), 'message')
- assert repr(BaseException(3)) == 'BaseException(3,)'
+ assert repr(BaseException(3)) == 'BaseException(3)'
assert str(BaseException(3)) == '3'
assert BaseException().args == ()
assert BaseException(3).args == (3,)
@@ -310,7 +310,7 @@
assert ModuleNotFoundError("message", name="x").name == "x"
assert ModuleNotFoundError("message", path="y").path == "y"
raises(TypeError, ModuleNotFoundError, invalid="z")
- assert repr(ModuleNotFoundError('test')) ==
"ModuleNotFoundError('test',)"
+ assert repr(ModuleNotFoundError('test')) ==
"ModuleNotFoundError('test')"
def test_blockingioerror(self):
args = ("a", "b", "c", "d", "e")
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit