Merge pull request #1343 from vazrupe/add-framework-attr

Add framework attribute in sys module
This commit is contained in:
Jeong YunWon
2019-09-11 03:00:09 +09:00
committed by GitHub
2 changed files with 6 additions and 0 deletions

View File

@@ -6,6 +6,9 @@ assert sys.argv[0].endswith('.py')
assert sys.platform == "linux" or sys.platform == "darwin" or sys.platform == "win32" or sys.platform == "unknown"
if hasattr(sys, "_framework"):
assert type(sys._framework) is str
assert isinstance(sys.builtin_module_names, tuple)
assert 'sys' in sys.builtin_module_names

View File

@@ -225,6 +225,8 @@ pub fn make_module(vm: &VirtualMachine, module: PyObjectRef, builtins: PyObjectR
"unknown".to_string()
};
let framework = "".to_string();
// https://doc.rust-lang.org/reference/conditional-compilation.html#target_endian
let bytorder = if cfg!(target_endian = "little") {
"little".to_string()
@@ -347,6 +349,7 @@ settrace() -- set the global debug tracing function
"modules" => modules.clone(),
"warnoptions" => ctx.new_list(vec![]),
"platform" => ctx.new_str(platform),
"_framework" => ctx.new_str(framework),
"meta_path" => ctx.new_list(vec![]),
"path_hooks" => ctx.new_list(vec![]),
"path_importer_cache" => ctx.new_dict(),