def __exit__(self, exc_type, exc_val, exc_tb):
if self.cleanup_import_caches:
# remove all modules which got added to sys.modules in this import, to
# ensure the next time we are here, they get reloaded.
self._restore_dict(sys.modules, 'modules')
self._restore_dict(sys.path_importer_cache, 'path_importer_cache')
sys.dont_write_bytecode = self.prev_dont_write_bytecode
评论列表
文章目录