Message401698
The attached file demonstrates the problem:
If importlib.invalidate_caches() is called while the zipfile used by the zip importer is not available the import system breaks entirely. I found this in a testsuite that accedently did this (it should have updated sys.path).
I get the following exception:
$ python3.10 t.py
Traceback (most recent call last):
File "/Users/ronald/Projects/modulegraph2/t.py", line 27, in <module>
import uu
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1002, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 945, in _find_spec
File "<frozen importlib._bootstrap_external>", line 1430, in find_spec
File "<frozen importlib._bootstrap_external>", line 1402, in _get_spec
File "<frozen zipimport>", line 168, in find_spec
File "<frozen zipimport>", line 375, in _get_module_info
TypeError: argument of type 'NoneType' is not iterable
This exception is not very friendly....
This particular exception is caused by setting self._files to None in the importer's invalidate_caches method, while not checking for None in _get_modules_info.
I'm not sure what the best fix would be, setting self._files to an empty list would likely be the easiest fix.
Note that the script runs without errors in Python 3.9. |
|
Date |
User |
Action |
Args |
2021-09-13 11:29:05 | ronaldoussoren | set | recipients:
+ ronaldoussoren |
2021-09-13 11:29:05 | ronaldoussoren | set | messageid: <1631532545.02.0.971781687861.issue45183@roundup.psfhosted.org> |
2021-09-13 11:29:04 | ronaldoussoren | link | issue45183 messages |
2021-09-13 11:29:04 | ronaldoussoren | create | |
|