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 barry
Recipients alex, barry
Date 2014-11-06.20:29:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
On Nov 06, 2014, at 08:10 PM, Alex Gaynor wrote:

>FWIW, I'm not convinced the pure python fallback code is sufficient either;
>time.time() doesn't have the necessary resolution AFAIK? Also clock_seq is
>generated using the random module's messerne twister, not SystemRandom().

Perhaps, but that's a different bug. ;)

-----snip snip-----
from uuid import UUID
import ctypes
import ctypes.util

lib = ctypes.CDLL(ctypes.util.find_library('uuid'))
_ugts = lib.uuid_generate_time_safe

_buffer = ctypes.create_string_buffer(16)
retval = _ugts(_buffer)

# Remember, this is C!
is_safe = (retval == 0)

print('{} is safe? {}'.format(UUID(bytes=_buffer.raw), is_safe))
-----snip snip-----

On Ubuntu 14.10, gives me:

xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx is safe? True
Date User Action Args
2014-11-06 20:29:02barrysetrecipients: + barry, alex
2014-11-06 20:29:02barrylinkissue22807 messages
2014-11-06 20:29:02barrycreate