mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
int.format error handling
This commit is contained in:
@@ -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