From 7bb530dd896389ff03f73bcd25d144b3b23d6645 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 14 Feb 2020 09:57:18 +0000 Subject: [PATCH] Fix exception repr --- Lib/test/test_baseexception.py | 2 -- vm/src/exceptions.rs | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Lib/test/test_baseexception.py b/Lib/test/test_baseexception.py index 5291e4598..044f27b5f 100644 --- a/Lib/test/test_baseexception.py +++ b/Lib/test/test_baseexception.py @@ -86,8 +86,6 @@ class ExceptionClassTests(unittest.TestCase): self.assertEqual(given, expected, "%s: %s != %s" % (test_name, given, expected)) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_interface_single_arg(self): # Make sure interface works properly when given a single argument arg = "spam" diff --git a/vm/src/exceptions.rs b/vm/src/exceptions.rs index c46377e9a..efb4f6eda 100644 --- a/vm/src/exceptions.rs +++ b/vm/src/exceptions.rs @@ -139,10 +139,7 @@ impl PyBaseException { fn repr(zelf: PyRef, vm: &VirtualMachine) -> String { let repr_args = exception_args_as_string(vm, zelf.args(), false); let cls = zelf.class(); - match repr_args.into_iter().exactly_one() { - Ok(one) => format!("{}({},)", cls.name, one), - Err(i) => format!("{}({})", cls.name, i.format(", ")), - } + format!("{}({})", cls.name, repr_args.iter().format(", ")) } }