[issue15206] uuid module falls back to unsuitable RNG

Christian Heimes report at bugs.python.org
Wed Jun 27 23:11:27 CEST 2012


Christian Heimes <lists at cheimes.de> added the comment:

IMHO it's all about managing expectations. As libuuid is using a crypto RNG before it falls back to a less suitable RNG. We should follow this example. I couldn't find any information about the implementation details of Window's UuidCreate().

I agree that we can disagree on my reasoning. However the usage of random.random() and random.randint() in uuid is flawed for a second reason. The default instance random._inst doesn't compensate for fork(). After fork() the two processes share the same random state and thus will create the same uuids. For example tempfile._RandomNameSequence re-creates the RNG when it notices a different PID.

----------
keywords: +patch
Added file: http://bugs.python.org/file26190/issue15206.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15206>
_______________________________________


More information about the Python-bugs-list mailing list