|
146 | 146 |
|
147 | 147 | try: |
148 | 148 | import threading |
149 | | -except ImportError: |
| 149 | +except ModuleNotFoundError: |
150 | 150 | threading = None |
151 | 151 | try: |
152 | 152 | import multiprocessing.process |
153 | | -except ImportError: |
| 153 | +except ModuleNotFoundError: |
154 | 154 | multiprocessing = None |
155 | 155 |
|
156 | 156 |
|
|
180 | 180 | if sys.platform == 'darwin': |
181 | 181 | try: |
182 | 182 | import resource |
183 | | - except ImportError: |
| 183 | + except ModuleNotFoundError: |
184 | 184 | pass |
185 | 185 | else: |
186 | 186 | soft, hard = resource.getrlimit(resource.RLIMIT_STACK) |
@@ -571,7 +571,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, |
571 | 571 | if findleaks: |
572 | 572 | try: |
573 | 573 | import gc |
574 | | - except ImportError: |
| 574 | + except ModuleNotFoundError: |
575 | 575 | print('No GC available, disabling findleaks.') |
576 | 576 | findleaks = False |
577 | 577 | else: |
@@ -692,7 +692,7 @@ def test_forever(tests=list(selected)): |
692 | 692 | if use_mp: |
693 | 693 | try: |
694 | 694 | from threading import Thread |
695 | | - except ImportError: |
| 695 | + except ModuleNotFoundError: |
696 | 696 | print("Multiprocess option requires thread support") |
697 | 697 | sys.exit(2) |
698 | 698 | from queue import Queue |
@@ -1396,7 +1396,7 @@ def dash_R(the_module, test, indirect_test, huntrleaks): |
1396 | 1396 | pic = sys.path_importer_cache.copy() |
1397 | 1397 | try: |
1398 | 1398 | import zipimport |
1399 | | - except ImportError: |
| 1399 | + except ModuleNotFoundError: |
1400 | 1400 | zdc = None # Run unmodified on platforms without zipimport support |
1401 | 1401 | else: |
1402 | 1402 | zdc = zipimport._zip_directory_cache.copy() |
@@ -1473,7 +1473,7 @@ def dash_R_cleanup(fs, ps, pic, zdc, abcs): |
1473 | 1473 | sys.path_importer_cache.update(pic) |
1474 | 1474 | try: |
1475 | 1475 | import zipimport |
1476 | | - except ImportError: |
| 1476 | + except ModuleNotFoundError: |
1477 | 1477 | pass # Run unmodified on platforms without zipimport support |
1478 | 1478 | else: |
1479 | 1479 | zipimport._zip_directory_cache.clear() |
@@ -1510,7 +1510,7 @@ def dash_R_cleanup(fs, ps, pic, zdc, abcs): |
1510 | 1510 | doctest.master = None |
1511 | 1511 | try: |
1512 | 1512 | import ctypes |
1513 | | - except ImportError: |
| 1513 | + except ModuleNotFoundError: |
1514 | 1514 | # Don't worry about resetting the cache if ctypes is not supported |
1515 | 1515 | pass |
1516 | 1516 | else: |
|
0 commit comments