Skip to content
Prev Previous commit
Next Next commit
Preserve the validated string key when creating builtins
Use the PyStr reference directly after validating the ASCII name, fixing the compile error from the previous PyUtf8Str-only accessor.

Assisted-by: Codex:model-version-unavailable
  • Loading branch information
youknowdot committed Oct 2, 2026
commit 6b0a49495f489494d13d5d71d191a47d7aa118e3
2 changes: 1 addition & 1 deletion crates/vm/src/stdlib/_imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ mod _imp {
module.__init_methods(vm)?;

// Add to sys.modules BEFORE exec (critical for circular import handling)
sys_modules.set_item(name.as_pystr(), module.clone().into(), vm)?;
sys_modules.set_item(&*name, module.clone().into(), vm)?;

// Phase 2: Call exec slot (can safely import other modules now)
if let Some(exec) = def.slots.exec {
Expand Down