This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xdegaye
Recipients barry, ned.deily, serhiy.storchaka, vstinner, xdegaye
Date 2017-12-02.11:08:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1512212912.31.0.213398074469.issue32107@psf.upfronthosting.co.za>
In-reply-to
Content
test_uuid fails now on android-24-armv7 on the master branch:

======================================================================
FAIL: test_getnode (test.test_uuid.TestUUIDWithoutExtModule)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/sdcard/org.python/lib/python3.7/test/test_uuid.py", line 312, in test_getnode
    self.assertEqual(node1, node2, '%012x != %012x' % (node1, node2))
AssertionError: 237015144408656 != 105397654869517 : d790637d2650 != 5fdbcdc7560d

Some context:
* There is no _uuid extension module.
* All the getters in uuid.getnode() fail: _ip_getnode() fails because the 'ip link list' command fails on Android while 'ip link' would have succeeded (and would have hidden the above bug), 'ifconfig' does not print MAC addresses and the commands of the other getters do not exist.

The following patch fixes the problem:

diff --git a/Lib/uuid.py b/Lib/uuid.py
index cb2bc092bd..be06a6eff3 100644
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -674,14 +674,14 @@ def getnode():
         getters = [_unix_getnode, _ifconfig_getnode, _ip_getnode,
                    _arp_getnode, _lanscan_getnode, _netstat_getnode]
 
-    for getter in getters:
+    for getter in getters + [_random_getnode]:
         try:
             _node = getter()
         except:
             continue
         if _node is not None:
             return _node
-    return _random_getnode()
+    assert False, '_random_getnode() returned None'
History
Date User Action Args
2017-12-02 11:08:32xdegayesetrecipients: + xdegaye, barry, vstinner, ned.deily, serhiy.storchaka
2017-12-02 11:08:32xdegayesetmessageid: <1512212912.31.0.213398074469.issue32107@psf.upfronthosting.co.za>
2017-12-02 11:08:32xdegayelinkissue32107 messages
2017-12-02 11:08:31xdegayecreate