Fix builtins.__name__

This commit is contained in:
Peter Ye authored and GitHub committed 2021-07-28 13:20:32 +09:00
1 parent 8a967e84c6
commit 8bfff805a9
2 files changed
+4 -2

No files matched your search

+4
View File
@@ -5,6 +5,10 @@ assert '__builtins__' in globals()
with assert_raises(AttributeError):
__builtins__.__builtins__
assert __builtins__.__name__ == "builtins"
import builtins
assert builtins.__name__ == "builtins"
__builtins__.x = 'new'
assert x == 'new' # noqa: F821
-2
View File
@@ -894,8 +894,6 @@ pub fn make_module(vm: &VirtualMachine, module: PyObjectRef) {
let debug_mode: bool = vm.state.settings.optimize == 0;
extend_module!(vm, module, {
"__debug__" => ctx.new_bool(debug_mode),
//set __name__ fixes: https://github.com/RustPython/RustPython/issues/146
"__name__" => ctx.new_str(String::from("__main__")),
"bool" => ctx.types.bool_type.clone(),
"bytearray" => ctx.types.bytearray_type.clone(),