Message309720
On 09/01/2018 16:21, Antoine Pitrou wrote:
> Antoine Pitrou <pitrou@free.fr> added the comment:
>
>> What is the desired behavior, specifically, of
> uuid.getnode() - constant, or 'random'?
>
> I'm also certain getnode() is supposed to return a hardware-determined number (usually the MAC address of an Ethernet interface). A random output wouldn't need so much platform-specific harness.
FYI
The current implementation (Lib/uuid.py) - python2 as an example with
with no _uuid support, compared to the master (as of yesterday) with
_uuid support.
Program (x2.py):
michael@x071:[/data/prj/python/git]cat *master/x2.py
import uuid
import sys
print (sys.version)
print("getnode = %x\n" % uuid.getnode())
print("getnode = %x\n" % uuid.getnode())
michael@x071:[/data/prj/python/git]python *master/x2.py
2.7.12 (default, Sep 29 2016, 12:02:17) [C]
getnode = a92929dc8a78
getnode = a92929dc8a78
michael@x071:[/data/prj/python/git]python *master/x2.py
2.7.12 (default, Sep 29 2016, 12:02:17) [C]
getnode = cdff09dd1306
getnode = cdff09dd1306
So it appears, everytime python runs - without _uuid - a new "getnode()"
value is established, for as long as the process runs (hoping!)
Below - the value returned is the MAC address of the first ethernet
adapter (ent0)
michael@x071:[/data/prj/python/git]gcc*/python *master/x2.py
3.7.0a3+ (default, Jan 8 2018, 16:05:08)
[GCC 4.7.4]
getnode = fad18cf76204
getnode = fad18cf76204
michael@x071:[/data/prj/python/git]xlc*/python *master/x2.py
3.7.0a3+ (heads/master:9b99747, Jan 8 2018, 15:50:03) [C]
getnode = fad18cf76204
getnode = fad18cf76204
*****
Is there any interest for a PR on Python2.7 and/or Python3.5? I guess it
could be considered a bug IF the getnode() value is suppossed to be
related to the MAC address and/or consistent over sessions.
HTH, Michael
>
> ----------
> nosy: +pitrou
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue28009>
> _______________________________________
> |
|
Date |
User |
Action |
Args |
2018-01-09 17:38:03 | Michael.Felt | set | recipients:
+ pitrou, vstinner, serhiy.storchaka, David.Edelsohn |
2018-01-09 17:38:03 | Michael.Felt | link | issue28009 messages |
2018-01-09 17:38:03 | Michael.Felt | create | |
|