diff --git a/vm/src/sysmodule.rs b/vm/src/sysmodule.rs index a1e1fa415a..2788dd7ebf 100644 --- a/vm/src/sysmodule.rs +++ b/vm/src/sysmodule.rs @@ -163,6 +163,14 @@ fn sys_exc_info(vm: &VirtualMachine) -> PyResult { })) } +fn sys_git_info(vm: &VirtualMachine) -> PyObjectRef { + vm.ctx.new_tuple(vec![ + vm.ctx.new_str("RustPython".to_string()), + vm.ctx.new_str(version::get_version_number()), + vm.ctx.new_str(version::get_git_revision()), + ]) +} + // TODO: raise a SystemExit here fn sys_exit(code: OptionalArg, _vm: &VirtualMachine) -> PyResult<()> { let code = code.unwrap_or(0); @@ -360,6 +368,7 @@ settrace() -- set the global debug tracing function "settrace" => ctx.new_rustfunc(sys_settrace), "version" => vm.new_str(version::get_version()), "version_info" => version_info, + "_git" => sys_git_info(vm), "exc_info" => ctx.new_rustfunc(sys_exc_info), "prefix" => ctx.new_str(prefix.to_string()), "base_prefix" => ctx.new_str(base_prefix.to_string()),