Message230762
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:02 | barry | set | recipients:
+ barry, alex |
2014-11-06 20:29:02 | barry | link | issue22807 messages |
2014-11-06 20:29:02 | barry | create | |
|