Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper underscore handling to float and complex types. #5356

Merged
merged 10 commits into from
Jul 28, 2024
Prev Previous commit
Next Next commit
remove all earlier changes in complex.rs and float.rs
  • Loading branch information
dannasman committed Jul 23, 2024
commit 39785852b398934b98bc41bc10430a0458be9535
5 changes: 2 additions & 3 deletions vm/src/builtins/complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,9 @@ fn parse_str(s: &str) -> Option<Complex64> {
"" | "+" => 1.0,
// "-j"
"-" => -1.0,
s => {
crate::literal::float::parse_str(s)?
}
s => crate::literal::float::parse_str(s)?,
};

Complex64::new(real, imag)
}
};
Expand Down
1 change: 0 additions & 1 deletion vm/src/builtins/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ fn float_from_string(val: PyObjectRef, vm: &VirtualMachine) -> PyResult<f64> {
val.class().name()
)));
};

crate::literal::float::parse_bytes(b).ok_or_else(|| {
val.repr(vm)
.map(|repr| vm.new_value_error(format!("could not convert string to float: {repr}")))
Expand Down
Loading