Merge pull request #1781 from philippeitis/patch-3

Raise TypeError when kwargs are not dict.
This commit is contained in:
Noah authored and GitHub committed 2020-02-28 15:05:29 -06:00
commit 88405cf574
1 file changed
+6 -2
+6 -2
View File
@@ -935,8 +935,12 @@ impl Frame {
}
bytecode::CallType::Ex(has_kwargs) => {
let kwargs = if *has_kwargs {
let kw_dict: PyDictRef =
self.pop_value().downcast().expect("Kwargs must be a dict.");
let kw_dict: PyDictRef = match self.pop_value().downcast() {
Err(_) => {
return Err(vm.new_type_error("Kwargs must be a dict.".to_owned()));
}
Ok(x) => x,
};
let mut kwargs = IndexMap::new();
for (key, value) in kw_dict.into_iter() {
if let Some(key) = key.payload_if_subclass::<objstr::PyString>(vm) {