Merge pull request #1393 from rls1004/issue1391

Fix the ValueError for whitespace in float()
This commit is contained in:
Noah
2019-09-21 09:41:50 -05:00
committed by GitHub

View File

@@ -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)?;