forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bpo-41364: Reduce import overhead of uuid module (pythonGH-21586)
- Loading branch information
1 parent
d851238
commit 59b14fb
Showing
2 changed files
with
10 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,6 @@ | |
""" | ||
|
||
import os | ||
import platform | ||
import sys | ||
|
||
from enum import Enum | ||
|
@@ -54,10 +53,13 @@ | |
__author__ = 'Ka-Ping Yee <[email protected]>' | ||
|
||
# The recognized platforms - known behaviors | ||
_AIX = platform.system() == 'AIX' | ||
_DARWIN = platform.system() == 'Darwin' | ||
_LINUX = platform.system() == 'Linux' | ||
_WINDOWS = platform.system() == 'Windows' | ||
if sys.platform in ('win32', 'darwin'): | ||
_AIX = _LINUX = False | ||
else: | ||
import platform | ||
_platform_system = platform.system() | ||
_AIX = _platform_system == 'AIX' | ||
_LINUX = _platform_system == 'Linux' | ||
|
||
_MAC_DELIM = b':' | ||
_MAC_OMITS_LEADING_ZEROES = False | ||
|
@@ -618,9 +620,9 @@ def _random_getnode(): | |
# @unittest.skipUnless(_uuid._ifconfig_getnode in _uuid._GETTERS, ...) | ||
if _LINUX: | ||
_OS_GETTERS = [_ip_getnode, _ifconfig_getnode] | ||
elif _DARWIN: | ||
elif sys.platform == 'darwin': | ||
_OS_GETTERS = [_ifconfig_getnode, _arp_getnode, _netstat_getnode] | ||
elif _WINDOWS: | ||
elif sys.platform == 'win32': | ||
# bpo-40201: _windll_getnode will always succeed, so these are not needed | ||
_OS_GETTERS = [] | ||
elif _AIX: | ||
|
1 change: 1 addition & 0 deletions
1
Misc/NEWS.d/next/Library/2020-07-21-21-45-55.bpo-41364.5O-k7A.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Reduce import overhead of :mod:`uuid`. |