Skip to content

Commit 26a3ec9

Browse files
authored
Merge pull request #4646 from dalinaum/winver
Add sys.winver
2 parents 8d6d47a + 5adae77 commit 26a3ec9

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

vm/src/stdlib/sys.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,13 @@ mod sys {
262262
version::get_version()
263263
}
264264

265+
#[cfg(windows)]
266+
#[pyattr]
267+
fn winver(_vm: &VirtualMachine) -> String {
268+
// Note: This is Python DLL version in CPython, but we arbitrary fill it for compatibility
269+
version::get_winver_number()
270+
}
271+
265272
#[pyattr]
266273
fn _xoptions(vm: &VirtualMachine) -> PyDictRef {
267274
let ctx = &vm.ctx;

vm/src/version.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ pub fn get_version_number() -> String {
2828
format!("{MAJOR}.{MINOR}.{MICRO}{RELEASELEVEL}")
2929
}
3030

31+
pub fn get_winver_number() -> String {
32+
format!("{MAJOR}.{MINOR}")
33+
}
34+
3135
pub fn get_compiler() -> String {
3236
format!("rustc {}", env!("RUSTC_VERSION"))
3337
}

0 commit comments

Comments
 (0)