Fix unsupported operand type of str problem

Modify panic! to Err for unsupported operand type of str problem

Fixes #1365
This commit is contained in:
HyeockJinKim
2019-09-12 01:54:57 +09:00
parent 86103bfd01
commit 2f96995f30

View File

@@ -1572,10 +1572,10 @@ pub fn subscript(vm: &VirtualMachine, value: &str, b: PyObjectRef) -> PyResult {
let string = value.to_string().get_slice_items(vm, &b)?;
Ok(vm.new_str(string))
} else {
panic!(
"TypeError: indexing type {:?} with index {:?} is not supported (yet?)",
Err(vm.new_type_error(format!(
"indexing type {:?} with index {:?} is not supported",
value, b
)
)))
}
}