[Patches] [ python-Patches-1541863 ] work around clocks with low resolution (uuid.py)

SourceForge.net noreply at sourceforge.net
Thu Aug 17 12:44:28 CEST 2006


Patches item #1541863, was opened at 2006-08-17 19:44
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1541863&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Hirokazu Yamamoto (ocean-city)
Assigned to: Nobody/Anonymous (nobody)
Summary: work around clocks with low resolution (uuid.py)

Initial Comment:
This patch improves workaround clocks with low
resolution yielding duplicate UUIDs. (rev51307)

Currently, windows buildbot is failing due to this bug.
http://www.python.org/dev/buildbot/trunk/x86%20XP%20trunk/builds/1390/step-test/0

Traceback (most recent call last):
  File
"C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_uuid.py",
line 381, in test_uuid1
    equal(len(uuids.keys()), 1000)
AssertionError: 998 != 1000

This happens because on this code (Lib/uuid.py),

   if timestamp == _last_timestamp:
       timestamp += 1
   _last_timestamp = timestamp

if timestamp is same value more than 3 times....

   timestamp == X and _last_timestamp != X:
       timestamp <- X + 1 and _last_timestamp <- X + 1

   timestamp == X: (again)
       timestamp != _last_timestamp, so timestamp is
       still X

   timestamp == X: (again)
       timestamp != _last_timestamp, so timestamp is
       still X (duplicated timestamp!)
       
I fixed this bug with attached patch.

# also fixed probably typo in test_uuid.py


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1541863&group_id=5470


More information about the Patches mailing list