bpo-11063, bpo-20519: avoid ctypes and improve import time for uuid by pitrou · Pull Request #3796 · python/cpython (original) (raw)

I hacked the code to disable _uuid, uuid_generate_time_safe and uuid_generate_time in uuid.py. With these changes, tests fail:

======================================================================
ERROR: test_unix_getnode (test.test_uuid.TestInternalsWithExtModule)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/haypo/prog/python/master/Lib/test/test_uuid.py", line 574, in test_unix_getnode
    self.check_node(self.uuid._unix_getnode(), 'unix')
  File "/home/haypo/prog/python/master/Lib/uuid.py", line 578, in _unix_getnode
    uuid_time, _ = _generate_time_safe()
TypeError: 'NoneType' object is not callable

======================================================================
ERROR: test_unix_getnode (test.test_uuid.TestInternalsWithoutExtModule)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/haypo/prog/python/master/Lib/test/test_uuid.py", line 574, in test_unix_getnode
    self.check_node(self.uuid._unix_getnode(), 'unix')
  File "/home/haypo/prog/python/master/Lib/uuid.py", line 578, in _unix_getnode
    uuid_time, _ = _generate_time_safe()
TypeError: 'NoneType' object is not callable

Python 3.6 test contains:

        try: # Issues 1481, 3581: _uuid_generate_time() might be None.
            node = uuid._unixdll_getnode()
        except TypeError:
            self.skipTest('requires uuid_generate_time')