Message 305636 - Python tracker

Message305636

Author David MacIver
Recipients David MacIver
Date 2017-11-06.11:31:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1509967887.83.0.213398074469.issue31958@psf.upfronthosting.co.za>
In-reply-to
Content
The documentation for the UUID module says the UUID.version field is "The UUID version number (1 through 5, meaningful only when the variant is RFC_4122)".

However, the UUID constructor doesn't actually validate that the version lies in that range if you don't pass a version to the constructor and, as a result, this isn't actually true - the version number can be anything between 0 and 15.

For an example consider the following:

>>> from uuid import UUID
>>> u = UUID(int=1133377179260751706062848)
>>> u.variant
'specified in RFC 4122'
>>> u.version
15

I have only actually run this example on Python 3.6, but inspection of the code suggests that it's been like this since its introduction.
History
Date User Action Args
2017-11-06 11:31:27David MacIversetrecipients: + David MacIver
2017-11-06 11:31:27David MacIversetmessageid: <1509967887.83.0.213398074469.issue31958@psf.upfronthosting.co.za>
2017-11-06 11:31:27David MacIverlinkissue31958 messages
2017-11-06 11:31:27David MacIvercreate