Skip to content

Commit d4bdda5

Browse files
committed
x
1 parent 8a0f0d0 commit d4bdda5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

crates/vm/src/frame.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,7 +2383,7 @@ impl ExecutingFrame<'_> {
23832383
let mod_name_obj = module.get_attr(identifier!(vm, __name__), vm).ok();
23842384
let mod_name_str = mod_name_obj
23852385
.as_ref()
2386-
.and_then(|n| n.downcast_ref::<PyStr>().map(|s| s.as_wtf8().to_string()));
2386+
.and_then(|n| n.downcast_ref::<PyStr>().map(|s| s.expect_str().to_owned()));
23872387
let module_name = mod_name_str.as_deref().unwrap_or("<unknown module name>");
23882388

23892389
let spec = module
@@ -2442,7 +2442,7 @@ impl ExecutingFrame<'_> {
24422442
format!("cannot import name '{name}' from '{module_name}' (unknown location)")
24432443
}
24442444
};
2445-
let err = vm.new_import_error(msg, vm.ctx.new_str(module_name));
2445+
let err = vm.new_import_error(msg, vm.ctx.new_utf8_str(module_name));
24462446

24472447
if let Some(ref path) = origin {
24482448
let _ignore = err

crates/vm/src/import.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ fn calc_package(globals: Option<&PyObjectRef>, vm: &VirtualMachine) -> PyResult<
593593
let mod_name = globals.get_item("__name__", vm).map_err(|_| {
594594
vm.new_import_error(
595595
"attempted relative import with no known parent package".to_owned(),
596-
vm.ctx.new_str(""),
596+
vm.ctx.new_utf8_str(""),
597597
)
598598
})?;
599599
let mod_name_str: PyStrRef = mod_name

0 commit comments

Comments
 (0)