[Python-checkins] r51353 - in python/branches/release25-maint: Lib/test/test_uuid.py Lib/uuid.py Misc/NEWS

martin.v.loewis python-checkins at python.org
Fri Aug 18 05:40:14 CEST 2006


Author: martin.v.loewis
Date: Fri Aug 18 05:40:13 2006
New Revision: 51353

Modified:
   python/branches/release25-maint/Lib/test/test_uuid.py
   python/branches/release25-maint/Lib/uuid.py
   python/branches/release25-maint/Misc/NEWS
Log:
Bug #1541863: uuid.uuid1 failed to generate unique identifiers
on systems with low clock resolution.


Modified: python/branches/release25-maint/Lib/test/test_uuid.py
==============================================================================
--- python/branches/release25-maint/Lib/test/test_uuid.py	(original)
+++ python/branches/release25-maint/Lib/test/test_uuid.py	Fri Aug 18 05:40:13 2006
@@ -429,7 +429,7 @@
 
         # Make sure the generated UUIDs are actually unique.
         uuids = {}
-        for u in [uuid.uuid1() for i in range(1000)]:
+        for u in [uuid.uuid4() for i in range(1000)]:
             uuids[u] = 1
         equal(len(uuids.keys()), 1000)
 

Modified: python/branches/release25-maint/Lib/uuid.py
==============================================================================
--- python/branches/release25-maint/Lib/uuid.py	(original)
+++ python/branches/release25-maint/Lib/uuid.py	Fri Aug 18 05:40:13 2006
@@ -488,8 +488,8 @@
     # 0x01b21dd213814000 is the number of 100-ns intervals between the
     # UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00.
     timestamp = int(nanoseconds/100) + 0x01b21dd213814000L
-    if timestamp == _last_timestamp:
-        timestamp += 1
+    if timestamp <= _last_timestamp:
+        timestamp = _last_timestamp + 1
     _last_timestamp = timestamp
     if clock_seq is None:
         import random

Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS	(original)
+++ python/branches/release25-maint/Misc/NEWS	Fri Aug 18 05:40:13 2006
@@ -9,6 +9,12 @@
 
 *Release date: XX-SEP-2006*
 
+Library
+-------
+
+- Bug #1541863: uuid.uuid1 failed to generate unique identifiers
+  on systems with low clock resolution.
+
 Build
 -----
 


More information about the Python-checkins mailing list