This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steve.dower
Recipients paul.moore, steve.dower, tim.golden, zach.ware
Date 2015-07-14.20:24:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1436905444.93.0.906882057092.issue24634@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-07-14 20:24:05steve.dowersetrecipients: + steve.dower, paul.moore, tim.golden, zach.ware
2015-07-14 20:24:04steve.dowersetmessageid: <1436905444.93.0.906882057092.issue24634@psf.upfronthosting.co.za>
2015-07-14 20:24:04steve.dowerlinkissue24634 messages
2015-07-14 20:24:03steve.dowercreate