Merge pull request #1644 from RustPython/coolreader18/exc-cleanup

Use PyBaseExceptionRef in places where we expect exceptions
This commit is contained in:
Noah
2019-12-29 17:17:26 -05:00
committed by GitHub
37 changed files with 506 additions and 444 deletions

View File

@@ -7,6 +7,7 @@ use super::objbytes;
use super::objint::{self, PyInt, PyIntRef};
use super::objstr::{PyString, PyStringRef};
use super::objtype::{self, PyClassRef};
use crate::exceptions::PyBaseExceptionRef;
use crate::function::{OptionalArg, OptionalOption};
use crate::pyhash;
use crate::pyobject::{
@@ -619,7 +620,7 @@ fn str_to_float(vm: &VirtualMachine, literal: &str) -> PyResult<f64> {
}
}
fn invalid_convert(vm: &VirtualMachine, literal: &str) -> PyObjectRef {
fn invalid_convert(vm: &VirtualMachine, literal: &str) -> PyBaseExceptionRef {
vm.new_value_error(format!("could not convert string to float: '{}'", literal))
}