]> granicus.if.org Git - python/commit
bpo-32107 - Improve MAC address calculation and fix test_uuid.py (#4600)
authorBarry Warsaw <barry@python.org>
Tue, 28 Nov 2017 22:26:04 +0000 (17:26 -0500)
committerGitHub <noreply@github.com>
Tue, 28 Nov 2017 22:26:04 +0000 (17:26 -0500)
commit23df2d1304ece169d7e0dfc843dfb8026b413d9f
treea7fdbffe4a5dc8e21f5b4a0734e5811451cc2aed
parent71bd588646b282c9eebc390b31184a5bdb54e712
bpo-32107 - Improve MAC address calculation and fix test_uuid.py (#4600)

``uuid.getnode()`` now preferentially returns universally administered MAC addresses if available, over locally administered MAC addresses.  This makes a better guarantee for global uniqueness of UUIDs returned from ``uuid.uuid1()``.  If only locally administered MAC addresses are available, the first such one found is returned.

Also improve internal code style by being explicit about ``return None`` rather than falling off the end of the function.

Improve the test robustness.
Doc/library/uuid.rst
Lib/test/test_uuid.py
Lib/uuid.py
Misc/NEWS.d/next/Library/2017-11-26-18-48-17.bpo-32107.h2ph2K.rst [new file with mode: 0644]