summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2015-07-14 20:25:03 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2015-07-14 20:25:03 (GMT)
commit1485054a2324b2f850d4fc25adbab7077fedc8f2 (patch)
tree12b0abb14f4ff0dfd7a9c361ea3790182449f401
parent77518434d0dbacb80cc19c7a1bb7c90beee457b8 (diff)
downloadcpython-1485054a2324b2f850d4fc25adbab7077fedc8f2.zip
cpython-1485054a2324b2f850d4fc25adbab7077fedc8f2.tar.gz
cpython-1485054a2324b2f850d4fc25adbab7077fedc8f2.tar.bz2
Issue #24634: Importing uuid should not try to load libc on Windows
-rw-r--r--Lib/uuid.py8
-rw-r--r--Misc/NEWS2
2 files changed, 8 insertions, 2 deletions
diff --git a/Lib/uuid.py b/Lib/uuid.py
index 0f0d8c1..151df35 100644
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -441,10 +441,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:
@@ -455,6 +459,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
@@ -463,7 +468,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()[2].split('.')[0]) >= 9:
diff --git a/Misc/NEWS b/Misc/NEWS
index 76e0226..7c7c82a 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -34,6 +34,8 @@ Core and Builtins
Library
-------
+- Issue #24634: Importing uuid should not try to load libc on Windows
+
- Issue #23652: Make it possible to compile the select module against the
libc headers from the Linux Standard Base, which do not include some
EPOLL macros. Initial patch by Matt Frank.