Commit 071e0ed8 authored by Alex Grönholm's avatar Alex Grönholm

Safer way to remove the import hook

--HG--
branch : agronholm/remove-the-import-hook-when-unloading-th-1458177009332
parent ae6ebd78
......@@ -192,11 +192,8 @@ def _conflict_bail(VC_err, version):
def _unload_pkg_resources():
from pkg_resources.extern import VendorImporter
sys.meta_path = [importer for importer in sys.meta_path if
not isinstance(importer, VendorImporter)]
del VendorImporter
importer.__class__.__module__ != 'pkg_resources.extern']
del_modules = [
name for name in sys.modules
if name.startswith('pkg_resources')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment