Repository: RustPython/RustPython (language: rust)

Issue:
Add sys.winver
Python documentation: https://docs.python.org/3/library/sys.html#sys.winver

It is DLL version of Python.
Though we don't have DLL library, it is required to load `site` correctly.

By the document, it is same as python `<major>.<minor>` version in most of cases.

we are defining them under `vm/src/versions.rs`


Discussion / hints:

Fix patch:
diff --git a/vm/src/stdlib/sys.rs b/vm/src/stdlib/sys.rs
index e202958b50..ba472f9f53 100644
--- a/vm/src/stdlib/sys.rs
+++ b/vm/src/stdlib/sys.rs
@@ -262,6 +262,13 @@ mod sys {
         version::get_version()
     }
 
+    #[cfg(windows)]
+    #[pyattr]
+    fn winver(_vm: &VirtualMachine) -> String {
+        // Note: This is Python DLL version in CPython, but we arbitrary fill it for compatibility
+        version::get_winver_number()
+    }
+
     #[pyattr]
     fn _xoptions(vm: &VirtualMachine) -> PyDictRef {
         let ctx = &vm.ctx;
diff --git a/vm/src/version.rs b/vm/src/version.rs
index 8c9516b907..ec23e896b0 100644
--- a/vm/src/version.rs
+++ b/vm/src/version.rs
@@ -28,6 +28,10 @@ pub fn get_version_number() -> String {
     format!("{MAJOR}.{MINOR}.{MICRO}{RELEASELEVEL}")
 }
 
+pub fn get_winver_number() -> String {
+    format!("{MAJOR}.{MINOR}")
+}
+
 pub fn get_compiler() -> String {
     format!("rustc {}", env!("RUSTC_VERSION"))
 }


Test patch: