New GitHub issue #95531 from eendebakpt:<br>
<hr>
<pre>
<!--
If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not
the right place to seek help. Consider the following options instead:
- reading the Python tutorial: https://docs.python.org/3/tutorial/
- posting in the "Users" category on discuss.python.org: https://discuss.python.org/c/users/7
- emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list
- searching our issue tracker (https://github.com/python/cpython/issues) to see if
your problem has already been reported
-->
# Bug report
Many python packages make calls to `platform.system()` or `platform.machine()` during the import. These functions call the generic `platform.uname()` . The result of `platform.uname()` is cached, but the first invocation is slow on windows (>100ms), adding 100ms import time to these packages. The slow part on windows is `def _syscmd_ver` which starts an external process.
Can we replace `_syscmd_ver` with a faster version (e.g. calling the windows api directly instead of using a external process)? Or refactor the `platform.system()` and `platform.machine()` functions to only retrieve the information required and not the general `uname`?
# Your environment
<!-- Include as many relevant details as possible about the environment you experienced the bug in -->
- CPython versions tested on: 3.11
- Operating system and architecture: Windows
<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
-->
</pre>
<hr>
<a href="https://github.com/python/cpython/issues/95531">View on GitHub</a>
<p>Labels: type-bug</p>
<p>Assignee: </p>