Module dict star import error checking
This changes it so that with star imports (e.g from foo import *), if an
item in the module.__dict__ isn't a string, raises a type error.
This can be caused by modifying globals(), adding a non string key. e.g:
>>>>> globals()[b"invalid"] = "invalid"
@@ -809,7 +809,7 @@ impl ExecutingFrame<'_> {
Box::new(|name| !name.starts_with('_'))
};
for (k, v) in &dict {
- let k = vm.to_str(&k)?;
+ let k = PyStringRef::try_from_object(vm, k)?;
let k = k.as_str();
if filter_pred(k) {
self.scope.store_name(&vm, k, v);
