Message246740
Lib/uuid.py includes the following code that runs on import:
import ctypes, ctypes.util
# 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']:
try:
lib = ctypes.CDLL(ctypes.util.find_library(libname))
except Exception:
continue
if hasattr(lib, 'uuid_generate_random'):
_uuid_generate_random = lib.uuid_generate_random
if hasattr(lib, 'uuid_generate_time'):
_uuid_generate_time = lib.uuid_generate_time
if _uuid_generate_random is not None:
break # found everything we were looking for
This code can cause issues on Windows when loading the CRT outside of an activation context (2.7) or in one case crashed Python 3.4 on a server (unfortunately I couldn't get access to the error logs - but I guessed that this section was responsible and turned out it was).
I propose adding a sys.platform check before running this code, to omit it on any platform starting with 'win' (patch to follow). I believe this should apply to all current versions of Python.
It is possible that someone has added their own "uuid.dll" to the DLL search path and is relying on that being found by uuid.py. I consider that unlikely and unsupported, but if people think that's a valid concern I can rework the patch to attempt to load uuid.dll but not the CRT on Windows. |
|
Date |
User |
Action |
Args |
2015-07-14 20:24:05 | steve.dower | set | recipients:
+ steve.dower, paul.moore, tim.golden, zach.ware |
2015-07-14 20:24:04 | steve.dower | set | messageid: <1436905444.93.0.906882057092.issue24634@psf.upfronthosting.co.za> |
2015-07-14 20:24:04 | steve.dower | link | issue24634 messages |
2015-07-14 20:24:03 | steve.dower | create | |
|