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 <>
Lib/ 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']:
            lib = ctypes.CDLL(ctypes.util.find_library(libname))
        except Exception:
        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 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:05steve.dowersetrecipients: + steve.dower, paul.moore, tim.golden, zach.ware
2015-07-14 20:24:04steve.dowersetmessageid: <>
2015-07-14 20:24:04steve.dowerlinkissue24634 messages
2015-07-14 20:24:03steve.dowercreate