Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Lib/uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ class UUID:
uuid_generate_time_safe(3).
"""

__slots__ = ('int', 'is_safe')

def __init__(self, hex=None, bytes=None, bytes_le=None, fields=None,
int=None, version=None,
*, is_safe=SafeUUID.unknown):
Expand Down Expand Up @@ -200,8 +202,8 @@ def __init__(self, hex=None, bytes=None, bytes_le=None, fields=None,
# Set the version number.
int &= ~(0xf000 << 64)
int |= version << 76
self.__dict__['int'] = int
self.__dict__['is_safe'] = is_safe
super().__setattr__('int', int)
super().__setattr__('is_safe', is_safe)
Copy link
Copy Markdown
Member

@vstinner vstinner Sep 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to use object.__setattr__(self, 'int', int).


def __eq__(self, other):
if isinstance(other, UUID):
Expand Down