From 5b6f34e3375282c2ad5f06eda95ff26843f0eefd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Sat, 22 Jun 2024 21:05:12 +0200 Subject: [PATCH] fixup --- Lib/uuid.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Lib/uuid.py b/Lib/uuid.py index 416053eb3c6be6..1f91043b428ac5 100644 --- a/Lib/uuid.py +++ b/Lib/uuid.py @@ -1,9 +1,9 @@ r"""UUID objects (universally unique identifiers) according to RFC 4122. This module provides immutable UUID objects (class UUID) and the functions -uuid1(), uuid3(), uuid4(), uuid5(), and uuid7() for generating version 1 to 7 -UUIDs as specified in RFC 4122 (superseeded by RFC 9562 but still referred to -as RFC 4122 for compatibility purposes). +uuid1(), uuid3(), uuid4(), uuid5(), and uuid7() for generating version 1, 3, +4, 5, and 7 UUIDs as specified in RFC 4122 (superseeded by RFC 9562 but still +referred to as RFC 4122 for compatibility purposes). If all you want is a unique ID, you should probably call uuid1() or uuid4(). Note that uuid1() may compromise privacy since it creates a UUID containing @@ -130,7 +130,7 @@ class UUID: variant the UUID variant (one of the constants RESERVED_NCS, RFC_4122, RESERVED_MICROSOFT, or RESERVED_FUTURE) - version the UUID version number (1 through 7, meaningful only + version the UUID version number (1, 3, 4, 5 and 7, meaningful only when the variant is RFC_4122) is_safe An enum indicating whether the UUID has been generated in @@ -215,7 +215,7 @@ def __init__(self, hex=None, bytes=None, bytes_le=None, fields=None, if not 0 <= int < 1<<128: raise ValueError('int is out of range (need a 128-bit value)') if version is not None: - if not 1 <= version <= 8: + if not 1 <= version <= 7: raise ValueError('illegal version number') # Set the variant to RFC 4122. int &= ~(0xc000 << 48) @@ -323,7 +323,8 @@ def clock_seq_low(self): @property def time(self): - return (self.time_hi << 48) | (self.time_mid << 32) | self.time_low + return (((self.time_hi_version & 0x0fff) << 48) | + (self.time_mid << 32) | self.time_low) @property def clock_seq(self):