Skip to content

Commit f13f772

Browse files
committed
Add framework attribute in sys module
Fixes #1342
1 parent c973ed8 commit f13f772

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

tests/snippets/sysmod.py

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66

77
assert sys.platform == "linux" or sys.platform == "darwin" or sys.platform == "win32" or sys.platform == "unknown"
88

9+
try:
10+
assert sys._framework == ""
11+
except AttributeError:
12+
assert "%d.%d" % sys.version_info[:2] < "3.7"
13+
except AssertionError:
14+
assert sys.platform == "darwin" and sys._framework == "Python"
15+
916
assert isinstance(sys.builtin_module_names, tuple)
1017
assert 'sys' in sys.builtin_module_names
1118

vm/src/sysmodule.rs

+3
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ pub fn make_module(vm: &VirtualMachine, module: PyObjectRef, builtins: PyObjectR
225225
"unknown".to_string()
226226
};
227227

228+
let framework = "".to_string();
229+
228230
// https://doc.rust-lang.org/reference/conditional-compilation.html#target_endian
229231
let bytorder = if cfg!(target_endian = "little") {
230232
"little".to_string()
@@ -347,6 +349,7 @@ settrace() -- set the global debug tracing function
347349
"modules" => modules.clone(),
348350
"warnoptions" => ctx.new_list(vec![]),
349351
"platform" => ctx.new_str(platform),
352+
"_framework" => ctx.new_str(framework),
350353
"meta_path" => ctx.new_list(vec![]),
351354
"path_hooks" => ctx.new_list(vec![]),
352355
"path_importer_cache" => ctx.new_dict(),

0 commit comments

Comments
 (0)