summaryrefslogtreecommitdiff
path: root/Lib/uuid.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2015-08-08 09:13:26 -0700
committerSteve Dower <steve.dower@microsoft.com>2015-08-08 09:13:26 -0700
commit0f363ff18ebfe37d6ab816d1cd739f96f9d0d9ab (patch)
treed7fa7dad3e3777fa4d2583a87493e1c699b3d4af /Lib/uuid.py
parent67c3c5c90fcfdffc61807d3b17e97422146408d7 (diff)
parent71a36f735ba8b70a4f6ff51fdc10f1c8df0285da (diff)
downloadcpython-git-0f363ff18ebfe37d6ab816d1cd739f96f9d0d9ab.tar.gz
Merge with 3.5
Diffstat (limited to 'Lib/uuid.py')
-rw-r--r--Lib/uuid.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/uuid.py b/Lib/uuid.py
index 5c731ec003..a6643ed451 100644
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -459,10 +459,14 @@ def _netbios_getnode():
_uuid_generate_random = _uuid_generate_time = _UuidCreate = None
try:
import ctypes, ctypes.util
+ import sys
# The uuid_generate_* routines are provided by libuuid on at least
# Linux and FreeBSD, and provided by libc on Mac OS X.
- for libname in ['uuid', 'c']:
+ _libnames = ['uuid']
+ if not sys.platform.startswith('win'):
+ _libnames.append('c')
+ for libname in _libnames:
try:
lib = ctypes.CDLL(ctypes.util.find_library(libname))
except Exception:
@@ -473,6 +477,7 @@ try:
_uuid_generate_time = lib.uuid_generate_time
if _uuid_generate_random is not None:
break # found everything we were looking for
+ del _libnames
# The uuid_generate_* functions are broken on MacOS X 10.5, as noted
# in issue #8621 the function generates the same sequence of values
@@ -481,7 +486,6 @@ try:
#
# Assume that the uuid_generate functions are broken from 10.5 onward,
# the test can be adjusted when a later version is fixed.
- import sys
if sys.platform == 'darwin':
import os
if int(os.uname().release.split('.')[0]) >= 9: