Skip to content

Commit

Permalink
PYTHON-4455 [v4.7] Improve import time on Windows (mongodb#1647)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored May 30, 2024
1 parent f38dfd6 commit d4592b6
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pymongo/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,14 @@ def _set_keepalive_times(sock: socket.socket) -> None:
"version": platform.mac_ver()[0],
}
elif sys.platform == "win32":
_ver = sys.getwindowsversion()
_METADATA["os"] = {
"type": platform.system(),
# "Windows XP", "Windows 7", "Windows 10", etc.
"name": " ".join((platform.system(), platform.release())),
"architecture": platform.machine(),
# Windows patch level (e.g. 5.1.2600-SP3)
"version": "-".join(platform.win32_ver()[1:3]),
"type": "Windows",
"name": "Windows",
# Avoid using platform calls, see PYTHON-4455.
"architecture": os.environ.get("PROCESSOR_ARCHITECTURE") or platform.machine(),
# Windows patch level (e.g. 10.0.17763-SP0).
"version": ".".join(map(str, _ver[:3])) + f"-SP{_ver[-1] or '0'}",
}
elif sys.platform.startswith("java"):
_name, _ver, _arch = platform.java_ver()[-1]
Expand Down

0 comments on commit d4592b6

Please sign in to comment.