summaryrefslogtreecommitdiffstats
path: root/Lib/uuid.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-35701: Added __weakref__ slot to uuid.UUID (GH-11570)David H2019-01-171-1/+1
| | | Added test for weakreferencing a uuid.UUID object.
* bpo-31784: Use time.time_ns() in uuid.uuid1() (GH-11189)Victor Stinner2018-12-181-2/+2
| | | | | uuid.uuid1() now calls time.time_ns() rather than int(time.time() * 1e9). Replace also int(nanoseconds/100) with nanoseconds // 100. Add an unit test.
* bpo-30977: rework code changes according to post-merge code review (GH-9106)Tal Einat2018-09-101-17/+10
| | | | also mention the change and its consequences in What's New
* bpo-30977: make uuid.UUID use __slots__ (GH-9078)Tal Einat2018-09-061-2/+26
| | | Co-Authored-By: Wouter Bolsterlee.
* bpo-33542: Ignore DUID in uuid.get_node on Windows. (GH-6922)CtrlZvi2018-05-201-1/+1
| | | | | | uuid._ipconfig_getnode did not validate the maximum length of the value, so long as the value had the same type of formatting as a MAC address. This let it select DUIDs as MAC addresses. It now requires an exact length match.
* bpo-32370: Use the correct encoding for ipconfig output in the uuid module. ↵Segev Finer2018-02-131-4/+6
| | | | (GH-5608)
* bpo-32502: Discard 64-bit (and other invalid) hardware addresses (#5254)Bo Bayles2018-01-241-6/+10
|
* bpo-32199: The getnode() ip getter now uses 'ip link' instead of 'ip link ↵xdegaye2017-12-071-1/+1
| | | | list' (GH-4696)
* Fix a regression in uuid added in bpo-32107. (#4677)Serhiy Storchaka2017-12-041-2/+2
| | | | | uuid.get_node() always must return a stable result. Also added a test for non-reproducibility of _random_getnode(). Original patch by Xavier de Gaye.
* bpo-32107 - Improve MAC address calculation and fix test_uuid.py (#4600)Barry Warsaw2017-11-281-11/+60
| | | | | | | | ``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.
* Revert "bpo-32107 - Better merge of #4494 (#4576)" (#4593)Victor Stinner2017-11-271-59/+11
| | | This reverts commit 9522a218f7dff95c490ff359cc60e8c2af35f5c8.
* bpo-32107 - Better merge of #4494 (#4576)Barry Warsaw2017-11-271-11/+59
| | | | | | | | | | | | | | | | Improve UUID1 MAC address calculation and related tests. There are two bits in the MAC address that are relevant to UUID1. The first is the locally administered vs. universally administered bit (second least significant of the first octet). Physical network interfaces such as ethernet ports and wireless adapters will always be universally administered, but some interfaces --such as the interface that MacBook Pros communicate with their Touch Bars-- are locally administered. The former are guaranteed to be globally unique, while the latter are demonstrably *not* globally unique and are in fact the same on every MBP with a Touch Bar. With this bit is set, the MAC is locally administered; with it unset it is universally administered. The other bit is the multicast bit (least significant bit of the first octet). When no other MAC address can be found, RFC 4122 mandates that a random 48-bit number be generated. This randomly generated number *must* have the multicast bit set. The improvements in uuid.py include: * Preferentially return a universally administered MAC address, falling back to a locally administered address if none of the former can be found. * Improve several coding style issues, such as adding explicit returns of None, using a more readable bitmask pattern, and assuming that the ultimate fallback, random MAC generation will not fail (and propagating any exception there instead of swallowing them). Improvements in test_uuid.py include: * Always testing the calculated MAC for universal administration, unless explicitly disabled (i.e. for the random case), or implicitly disabled due to running in the Travis environment. Travis test machines have *no* universally administered MAC address at the time of this writing.
* bpo-9678: Fix determining the MAC address in the uuid module. (#4264)Serhiy Storchaka2017-11-041-2/+16
| | | | | | * Using ifconfig on NetBSD and OpenBSD. * Using arp on Linux, FreeBSD, NetBSD and OpenBSD. Based on patch by Takayuki Shimizukawa.
* bpo-11063: Fix _uuid module on macOS (#3855)Victor Stinner2017-10-021-1/+1
| | | | | On macOS, use uuid_generate_time() instead of uuid_generate_time_safe() of libuuid, since uuid_generate_time_safe() is not available.
* bpo-11063, bpo-20519: avoid ctypes and improve import time for uuid (#3796)Antoine Pitrou2017-09-281-68/+108
| | | | bpo-11063, bpo-20519: avoid ctypes and improve import time for uuid.
* remove IRIX support (closes bpo-31341) (#3310)Benjamin Peterson2017-09-041-1/+1
| | | See PEP 11.
* bpo-22807: Expose platform UUID generation safety information. (#138)Barry Warsaw2017-02-181-6/+37
| | | | bpo-22807: Expose platform UUID generation safety information.
* Removed unused imports.Serhiy Storchaka2016-04-241-1/+0
|
* Issue #19164: Improve exception message of uuid.UUID()Berker Peksag2016-03-201-1/+2
| | | | Patch by jgauthier.
* always use os.urandom for the uuid4 algorithm (closes #25515)Benjamin Peterson2015-10-301-20/+6
|
* Issue #24634: Importing uuid should not try to load libc on WindowsSteve Dower2015-07-141-2/+6
|
* Issue #16261: Converted some bare except statements to except statementsSerhiy Storchaka2015-05-201-2/+2
| | | | with specified exception type. Original patch by Ramchandra Apte.
* Issue #23326: Removed __ne__ implementations. Since fixing default __ne__Serhiy Storchaka2015-01-311-5/+0
| | | | implementation in issue #21408 they are redundant.
* Issue #22902: The "ip" command is now used on Linux to determine MAC addressSerhiy Storchaka2014-11-301-2/+9
| | | | in uuid.getnode(). Pach by Bruno Cauet.
* Issue #19720: Suppressed context for some exceptions in importlib.Serhiy Storchaka2014-11-211-1/+4
|\
| * Issue #17293: socket.gethostbyname() can raise an exception of FreeBSD.Serhiy Storchaka2014-11-211-1/+4
| |
* | Issue #17293: uuid.getnode() now determines MAC address on AIX using netstat.Serhiy Storchaka2014-11-071-28/+55
|\ \ | |/ | | | | Based on patch by Aivars Kalvāns.
| * Issue #17293: uuid.getnode() now determines MAC address on AIX using netstat.Serhiy Storchaka2014-11-071-19/+50
| | | | | | | | Based on patch by Aivars Kalvāns.
| * Issue #22131: Fixed a bug in handling an error occured during reading fromSerhiy Storchaka2014-09-061-3/+1
| | | | | | | | a pipe in _ipconfig_getnode().
* | Issue #22793, #22637: Add missing "import os" in uuid._ifconfig_getnode()Victor Stinner2014-11-051-0/+1
| |
* | Issue #22637: avoid using a shell in uuidVictor Stinner2014-10-211-12/+20
| | | | | | | | Replace os.popen() with subprocess.Popen() in the uuid module.
* | Issue #22131: Modernized the code of the uuid module.Serhiy Storchaka2014-09-061-21/+12
| | | | | | | | | | | | | | | | Optimized bytes and bytes_le properties of UUID and UUID constructor with bytes_le argument. Fixed a bug in handling an error occured during reading from a pipe in _ipconfig_getnode().
* | Issue #22033: Reprs of most Python implemened classes now contain actualSerhiy Storchaka2014-07-251-1/+1
|/ | | | class name instead of hardcoded one.
* Merge #19855: restore use of LC_ALL, not LC_MESSAGESR David Murray2014-01-181-3/+4
|\
| * #19855: restore use of LC_ALL, not LC_MESSAGESR David Murray2014-01-181-2/+2
| | | | | | | | | | | | I didn't realize LC_ALL was an override, and I should have. I tried to make a test, but it is not clear that the LC variables actually affect the strings that uuid is using to parse the command output.
* | Merge: #19855: uuid.get_node now looks on the PATH for executables on unix.R David Murray2013-12-181-27/+28
|\ \ | |/
| * #19855: uuid.get_node now looks on the PATH for executables on unix.R David Murray2013-12-181-27/+28
| | | | | | | | Patch by Serhiy Storchaka.
* | Issue #11508: Fixed uuid.getnode() and uuid.uuid1() on environment withSerhiy Storchaka2013-11-261-2/+10
|\ \ | |/ | | | | virtual interface. Original patch by Kent Frazier.
| * Issue #11508: Fixed uuid.getnode() and uuid.uuid1() on environment withSerhiy Storchaka2013-11-261-2/+10
| | | | | | | | virtual interface. Original patch by Kent Frazier.
* | Issue #18784: The uuid module no more attempts to load libc via ctypes.CDLL,Serhiy Storchaka2013-09-131-0/+2
|\ \ | |/ | | | | | | if all necessary functions are already found in libuuid. Patch by Evgeny Sologubov.
| * Issue #18784: The uuid module no more attempts to load libc via ctypes.CDLL,Serhiy Storchaka2013-09-131-0/+2
| | | | | | | | | | if all necessary functions are already found in libuuid. Patch by Evgeny Sologubov.
* | utilize int.from_bytesPhilip Jenvey2013-08-301-1/+1
| |
* | Issue #16102: Make uuid._netbios_getnode() work again on Python 3.Serhiy Storchaka2013-06-091-1/+1
|\ \ | |/
| * Issue #16102: Make uuid._netbios_getnode() work again on Python 3.Serhiy Storchaka2013-06-091-1/+1
| |
* | Replace IOError with OSError (#16715)Andrew Svetlov2012-12-251-2/+2
|/
* Issue #15118: Change return value of os.uname() and os.times() fromLarry Hastings2012-06-241-1/+1
| | | | | plain tuples to immutable iterable objects with named attributes (structseq objects).
* Shift the pipe-using code into an else block, then close the pipeBrian Curtin2010-11-051-4/+7
| | | | in finally. Removes two ResourceWarnings.
* Fix ResourceWarning for unclosed files (from os.popen)Brian Curtin2010-10-311-7/+7
|
* Merged revisions 82276 via svnmerge fromRonald Oussoren2010-06-271-3/+3
| | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r82276 | ronald.oussoren | 2010-06-27 14:43:47 +0200 (Sun, 27 Jun 2010) | 5 lines The uuid library on OSX 10.5 seems to contain the same bug as the one on OSX 10.6, therefore don't use it there either. This fixes issue8621. ........
* Merged revisions 80784 via svnmerge fromRonald Oussoren2010-05-051-0/+13
| | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r80784 | ronald.oussoren | 2010-05-05 16:48:37 +0200 (Wed, 05 May 2010) | 9 lines The C function used by uuid.uuid4 is broken on OSX 10.6 in that after os.fork() the parent and child generate the same sequence of UUIDs. This patch falls back to the the Python implementation on OSX 10.6 or later. Fixes issue #8621. ........