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