Skip to content

Commit 41460f3

Browse files
committed
Implement sys._git
1 parent 00a0e45 commit 41460f3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

vm/src/sysmodule.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ fn sys_exc_info(vm: &VirtualMachine) -> PyResult {
163163
}))
164164
}
165165

166+
fn sys_git_info(vm: &VirtualMachine) -> PyObjectRef {
167+
vm.ctx.new_tuple(vec![
168+
vm.ctx.new_str("RustPython".to_string()),
169+
vm.ctx.new_str(version::get_version_number()),
170+
vm.ctx.new_str(version::get_git_revision()),
171+
])
172+
}
173+
166174
// TODO: raise a SystemExit here
167175
fn sys_exit(code: OptionalArg<i32>, _vm: &VirtualMachine) -> PyResult<()> {
168176
let code = code.unwrap_or(0);
@@ -360,6 +368,7 @@ settrace() -- set the global debug tracing function
360368
"settrace" => ctx.new_rustfunc(sys_settrace),
361369
"version" => vm.new_str(version::get_version()),
362370
"version_info" => version_info,
371+
"_git" => sys_git_info(vm),
363372
"exc_info" => ctx.new_rustfunc(sys_exc_info),
364373
"prefix" => ctx.new_str(prefix.to_string()),
365374
"base_prefix" => ctx.new_str(base_prefix.to_string()),

0 commit comments

Comments
 (0)