mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
int.format error handling
This commit is contained in:
1 parent
a50ca743dc
commit
4d244f0d07
1 file changed
+2
-5
@@ -589,12 +589,9 @@ impl PyInt {
|
||||
|
||||
#[pymethod(magic)]
|
||||
fn format(&self, spec: PyStrRef, vm: &VirtualMachine) -> PyResult<String> {
|
||||
match FormatSpec::parse(spec.as_str())
|
||||
FormatSpec::parse(spec.as_str())
|
||||
.and_then(|format_spec| format_spec.format_int(&self.value))
|
||||
{
|
||||
Ok(string) => Ok(string),
|
||||
Err(err) => Err(vm.new_value_error(err.to_string())),
|
||||
}
|
||||
.map_err(|msg| vm.new_value_error(msg.to_owned()))
|
||||
}
|
||||
|
||||
#[pymethod(magic)]
|
||||
|
||||
Reference in new issue
Block a user