[issue34732] uuid returns version more than 5

2020-01-12 Thread Tal Einat


Tal Einat  added the comment:

The uuid module is likely used on a huge variety of operating systems and 
hardware; I feel making UUID.__init__() reject values which it accepted until 
now would unnecessarily break existing code.  While raising an exception in 
__init__ seems more natural and correct in theory, it is also a larger break in 
backwards-compatibility.

I'm specifically worried by the _windll() example in PR GH-9417, in which a 
non-RFC 4122 conforming UUID is created, leading to the addition of the new 
"strict" keyword argument so that we can disable the new check in __init__ in 
this case.  There's a good chance that there are other such scenarios of which 
we're simply not yet aware.

In light of this, returning None for UUID.version, as in PR GH-9413, actually 
seems like a very reasonable solution.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34732] uuid returns version more than 5

2020-01-12 Thread Tal Einat


Change by Tal Einat :


--
versions: +Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34732] uuid returns version more than 5

2020-01-11 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Updating version and adding some people to the nosy list to review the two 
suggested pull requests for this issue.  Thanks!

--
nosy: +barry, cheryl.sabella, taleinat, twouters
versions: +Python 3.9 -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34732] uuid returns version more than 5

2018-09-20 Thread Berker Peksag


Berker Peksag  added the comment:

> I had raised a PR in github when i have created this ticket but forgot
> to add it here: https://github.com/python/cpython/pull/9413

Thanks for the PR, Jophine :) I saw your PR yesterday, but I thought fixing 
this in __init__ would be a better solution. I may be wrong, though, so let's 
see what other core devs think.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34732] uuid returns version more than 5

2018-09-20 Thread Richard Neumann


Richard Neumann  added the comment:

I updated my pull request.
Since "_windll_getnode()" is only returning a (random?) node for a UUID, I 
circumevented the value checking by introducing a new keyword-only argument 
"strict" defaulting to "True", there being set to "False".

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34732] uuid returns version more than 5

2018-09-20 Thread jophine antony


jophine antony  added the comment:

I had raised a PR in github when i have created this ticket but forgot to add 
it here: https://github.com/python/cpython/pull/9413

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34732] uuid returns version more than 5

2018-09-19 Thread Berker Peksag


Berker Peksag  added the comment:

Thanks for the report and for the PRs. The approach in PR 9417 seems reasonable 
to me, but we need to add some tests for all supported platforms and fix the 
test_windll_getnode test.

I'm removing Python 3.6 from the versions list since it's nearly end of its 
bugfix maintenance period and fixing this relatively harmless bug may break 
people's code in the wild.

--
components: +Library (Lib)
nosy: +berker.peksag
type:  -> behavior
versions:  -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34732] uuid returns version more than 5

2018-09-19 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Seems there is an open issue about this : https://bugs.python.org/issue31958

Thanks

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34732] uuid returns version more than 5

2018-09-19 Thread Richard Neumann

Richard Neumann  added the comment:

Typos:
"For explicitely checking the version" → "For explicitely *setting* the 
version".
"on not 1<= verision 1<=5" → "on not 1 <= version <= 5".

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34732] uuid returns version more than 5

2018-09-19 Thread Richard Neumann


Richard Neumann  added the comment:

@xtreak RFC 4122, section 4.1.3. specifies only versions 1 to 5.
For explicitely checking the version, there is already a test in UUID.__init__, 
raising a ValueError on not 1<= verision 1<=5.
I moved it to the bottom of __init__, i.e. after setting the "int" property, 
causing the test to run on the actual instance's property value.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34732] uuid returns version more than 5

2018-09-19 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

I think this is a valid UUID and trying this on JDK 9 also returns 15 for the 
version like Python. Am I missing something here?

➜  ~ jshell
|  Welcome to JShell -- Version 9.0.4
|  For an introduction type: /help intro

jshell> import java.util.*

jshell> UUID.fromString("481a8de5-f0d1-f211-b425-e41f134196da").version()
$2 ==> 15

jshell> UUID.fromString("481a8de5-f0d1-f211-b425-e41f134196da").variant()
$3 ==> 2

JDK implementation : 
http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/util/UUID.java#l247


Thanks

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34732] uuid returns version more than 5

2018-09-19 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +8837

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34732] uuid returns version more than 5

2018-09-19 Thread Richard Neumann


Richard Neumann  added the comment:

I'm not sure whether the property method should be changed.
I think it'd be more appropriate to raise a value error upon __init__ in this 
case as it is done with other checks.

--
nosy: +conqp

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34732] uuid returns version more than 5

2018-09-19 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34732] uuid returns version more than 5

2018-09-19 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +8833
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34732] uuid returns version more than 5

2018-09-19 Thread jophine antony


New submission from jophine antony :

When I validate the invalid uuid (RFC 4122 variant) for example 
'481a8de5-f0d1-f211-b425-e41f134196da'. It returns version number as 15 which 
is invalid. We need to retrun None in this case as we do for invalid UUIDs  
based on RFC 4122.

--snip snip---
from uuid import UUID
test_uuid_str = '481a8de5-f0d1-f211-b425-e41f134196da'
print("UUID version: {}".format(UUID(test_uuid_str).version))
print("UUID variant: {}".format(UUID(test_uuid_str).variant))
--snip snip---

--Result--
UUID version: 15
UUID variant: specified in RFC 4122
--Result--

--
messages: 325707
nosy: jophine pranjal
priority: normal
severity: normal
status: open
title: uuid returns version more than 5
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com