mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
Merge pull request #1393 from rls1004/issue1391
Fix the ValueError for whitespace in float()
This commit is contained in:
@@ -323,7 +323,7 @@ impl PyFloat {
|
||||
} else if objtype::isinstance(&arg, &vm.ctx.int_type()) {
|
||||
objint::get_float_value(&arg, vm)?
|
||||
} else if objtype::isinstance(&arg, &vm.ctx.str_type()) {
|
||||
match lexical::try_parse(objstr::get_value(&arg)) {
|
||||
match lexical::try_parse(objstr::get_value(&arg).trim()) {
|
||||
Ok(f) => f,
|
||||
Err(_) => {
|
||||
let arg_repr = vm.to_pystr(&arg)?;
|
||||
|
||||
Reference in New Issue
Block a user