Skip to content

Commit 7bb530d

Browse files
committed
Fix exception repr
1 parent 378a36c commit 7bb530d

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

Lib/test/test_baseexception.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ def interface_test_driver(self, results):
8686
self.assertEqual(given, expected, "%s: %s != %s" % (test_name,
8787
given, expected))
8888

89-
# TODO: RUSTPYTHON
90-
@unittest.expectedFailure
9189
def test_interface_single_arg(self):
9290
# Make sure interface works properly when given a single argument
9391
arg = "spam"

vm/src/exceptions.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,7 @@ impl PyBaseException {
139139
fn repr(zelf: PyRef<Self>, vm: &VirtualMachine) -> String {
140140
let repr_args = exception_args_as_string(vm, zelf.args(), false);
141141
let cls = zelf.class();
142-
match repr_args.into_iter().exactly_one() {
143-
Ok(one) => format!("{}({},)", cls.name, one),
144-
Err(i) => format!("{}({})", cls.name, i.format(", ")),
145-
}
142+
format!("{}({})", cls.name, repr_args.iter().format(", "))
146143
}
147144
}
148145

0 commit comments

Comments
 (0)