[Python-checkins] cpython (3.5): Issue #24634: Importing uuid should not try to load libc on Windows
steve.dower
python-checkins at python.org
Sat Aug 8 18:14:52 CEST 2015
https://hg.python.org/cpython/rev/1df7a0821c73
changeset: 97330:1df7a0821c73
branch: 3.5
user: Steve Dower <steve.dower at microsoft.com>
date: Tue Jul 14 13:25:03 2015 -0700
summary:
Issue #24634: Importing uuid should not try to load libc on Windows
files:
Lib/uuid.py | 8 ++++++--
Misc/NEWS | 2 ++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Lib/uuid.py b/Lib/uuid.py
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -459,10 +459,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 Exception:
@@ -473,6 +477,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
@@ -481,7 +486,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().release.split('.')[0]) >= 9:
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,6 +15,8 @@
Library
-------
+- Issue #24634: Importing uuid should not try to load libc on Windows
+
- Issue #24798: _msvccompiler.py doesn't properly support manifests
- Issue #4395: Better testing and documentation of binary operators.
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list