portable uuid module

Harald Meland harald.meland at usit.uio.no
Sun Apr 17 16:45:03 BST 2005


[Denys Duchier]

> Harald Meland <harald.meland at usit.uio.no> writes:
>
> Thanks for the fix:
>
>> Attached is a patch for the bugs I've found, the most important being
>> a missing "return" in _uuid_generate().
>
> applied.  I omitted the chunk that did this:
>
>> +import random
>> -from random import randint as _randint
>>
>> +_randint = random.randint
>
> because I didn't see the point.

In _get_random_reader(), you have a call to random.seed.  That will
raise an exception when no 'random' (module) object is to be seen in
that scope.  Of course, the exception will be caught by the bare
"except: pass" on the next line, but I doubt that's the reason for
having that bare except there.

[ The same goes for _get_6bytes() use of time.strftime when only
  time.mktime has been imported as _mktime. ]

It also seems that you altered my patch wrt linux_generate(); you're
trying to call '_linux_generate()' to test for presence of
/proc/sys/kernel/random/uuid, but as far as I can tell there is no
function bearing that name in your module.  I think you want the
function named 'linux_generate()', i.e. without any leading
underscore.

pychecker is your friend,
-- 
Harald




More information about the bazaar mailing list