Skip to content

Add framework attribute in sys module #1343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tests/snippets/sysmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

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

Expand Down
3 changes: 3 additions & 0 deletions vm/src/sysmodule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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(),
Expand Down