changeset: 97332:90e2747425ad branch: 2.7 parent: 97321:418095f0d711 user: Steve Dower date: Tue Jul 14 13:25:03 2015 -0700 files: Lib/uuid.py Misc/NEWS description: Issue #24634: Importing uuid should not try to load libc on Windows diff -r 418095f0d711 -r 90e2747425ad Lib/uuid.py --- a/Lib/uuid.py Fri Aug 07 19:47:36 2015 -0700 +++ b/Lib/uuid.py Tue Jul 14 13:25:03 2015 -0700 @@ -441,10 +441,14 @@ _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 @@ _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 @@ # # 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 -r 418095f0d711 -r 90e2747425ad Misc/NEWS --- a/Misc/NEWS Fri Aug 07 19:47:36 2015 -0700 +++ b/Misc/NEWS Tue Jul 14 13:25:03 2015 -0700 @@ -34,6 +34,8 @@ 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.