From 6e7e6ecfce9570ad57089bf6364499dbc23c80f6 Mon Sep 17 00:00:00 2001 From: MinJeong Kim <98nba@naver.com> Date: Fri, 20 Sep 2019 17:38:22 +0000 Subject: [PATCH] Fix the ValueError for whitespace in float() Ignore whitespace Fixed: #1391 --- vm/src/obj/objfloat.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/src/obj/objfloat.rs b/vm/src/obj/objfloat.rs index 8945840bb..3b67fc1d7 100644 --- a/vm/src/obj/objfloat.rs +++ b/vm/src/obj/objfloat.rs @@ -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)?;