diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index cf474cbb7..a024dd167 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -3681,8 +3681,6 @@ class PathTConverterTests(unittest.TestCase): 'os.PathLike'): fn(fd, *extra_args) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_path_t_converter_and_custom_class(self): msg = r'__fspath__\(\) to return str or bytes, not %s' with self.assertRaisesRegex(TypeError, msg % r'int'): diff --git a/vm/src/stdlib/os.rs b/vm/src/stdlib/os.rs index 9c54019f7..7c5e0bfce 100644 --- a/vm/src/stdlib/os.rs +++ b/vm/src/stdlib/os.rs @@ -158,14 +158,14 @@ fn fspath(obj: PyObjectRef, check_for_nul: bool, vm: &VirtualMachine) -> PyResul } let method = vm.get_method_or_type_error(obj.clone(), "__fspath__", || { format!( - "expected str, bytes or os.PathLike object, not '{}'", + "expected str, bytes or os.PathLike object, not {}", obj.class().name ) })?; let result = vm.invoke(&method, ())?; match1(&result)?.ok_or_else(|| { vm.new_type_error(format!( - "expected {}.__fspath__() to return str or bytes, not '{}'", + "expected {}.__fspath__() to return str or bytes, not {}", obj.class().name, result.class().name, ))