You've already forked macports-ports
mirror of
https://github.com/macports/macports-ports.git
synced 2026-07-12 18:20:25 -07:00
b8e715ba07
Closes: https://trac.macports.org/ticket/57034 Signed-off-by: Ryan Schmidt <ryandesign@macports.org>
41 lines
1.2 KiB
Diff
41 lines
1.2 KiB
Diff
Fix uuid failure on systems with 64-bit hardware addresses:
|
|
https://bugs.python.org/issue32502
|
|
Backported from:
|
|
https://github.com/python/cpython/commit/d69794f4df81de731cc66dc82136e28bee691e1e#diff-9d2d23bf4362c9ec2b6dd4b64b73756c
|
|
--- Lib/uuid.py.orig 2014-10-12 01:52:03.000000000 -0500
|
|
+++ Lib/uuid.py 2018-08-26 02:34:07.000000000 -0500
|
|
@@ -494,6 +494,11 @@
|
|
|
|
_node = None
|
|
|
|
+_NODE_GETTERS_WIN32 = [_windll_getnode, _netbios_getnode, _ipconfig_getnode]
|
|
+
|
|
+_NODE_GETTERS_UNIX = [_unixdll_getnode, _ifconfig_getnode]
|
|
+
|
|
+
|
|
def getnode():
|
|
"""Get the hardware address as a 48-bit positive integer.
|
|
|
|
@@ -509,17 +514,18 @@
|
|
|
|
import sys
|
|
if sys.platform == 'win32':
|
|
- getters = [_windll_getnode, _netbios_getnode, _ipconfig_getnode]
|
|
+ getters = _NODE_GETTERS_WIN32
|
|
else:
|
|
- getters = [_unixdll_getnode, _ifconfig_getnode]
|
|
+ getters = _NODE_GETTERS_UNIX
|
|
|
|
for getter in getters + [_random_getnode]:
|
|
try:
|
|
_node = getter()
|
|
except:
|
|
continue
|
|
- if _node is not None:
|
|
+ if (_node is not None) and (0 <= _node < (1 << 48)):
|
|
return _node
|
|
+ assert False, '_random_getnode() returned invalid value: {}'.format(_node)
|
|
|
|
_last_timestamp = None
|
|
|