Skip to content

Commit c0a6f61

Browse files
authored
Merge pull request RustPython#1393 from rls1004/issue1391
Fix the ValueError for whitespace in float()
2 parents 59d4e4e + 6e7e6ec commit c0a6f61

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

vm/src/obj/objfloat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ impl PyFloat {
323323
} else if objtype::isinstance(&arg, &vm.ctx.int_type()) {
324324
objint::get_float_value(&arg, vm)?
325325
} else if objtype::isinstance(&arg, &vm.ctx.str_type()) {
326-
match lexical::try_parse(objstr::get_value(&arg)) {
326+
match lexical::try_parse(objstr::get_value(&arg).trim()) {
327327
Ok(f) => f,
328328
Err(_) => {
329329
let arg_repr = vm.to_pystr(&arg)?;

0 commit comments

Comments
 (0)