Message334429
Closing this without any changes contradicts the answer we gave Ronald on #35791 that it's expected behaviour for importlib.find_spec() to throw an exception for already loaded modules without a __spec__ attribute.
So if this stays closed, then we should reopen #35791, and treat it as a feature request to either:
1. add a "ignore_module_cache" option to bypass sys.modules; or
2. revert to searching for the original spec in cases where the sys.modules entry has no __spec__ attribute (which has the virtue of just working for cases of the "replace yourself in sys.modules" idiom)
That said, the typing pseudo submodules *can* populate their __spec__ with useful information by copying most of their attributes from `typing.__spec__`, but setting their __spec__.loader attribute to one that throws an ImportError with a message saying to import `typing` instead of attempting to reload the submodule directly. |
|
Date |
User |
Action |
Args |
2019-01-27 14:50:23 | ncoghlan | set | recipients:
+ ncoghlan, gvanrossum, barry, brett.cannon, ronaldoussoren, eric.snow |
2019-01-27 14:50:21 | ncoghlan | set | messageid: <1548600621.45.0.645312277596.issue35806@roundup.psfhosted.org> |
2019-01-27 14:50:21 | ncoghlan | link | issue35806 messages |
2019-01-27 14:50:21 | ncoghlan | create | |
|