Barry A. Warsaw added the comment:
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
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue22807>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com