Commits

Jason R. Coombs  committed e0ebb38

Exclude 'encodings' modules when removing modules from sys.modules. Workaround for #285. (Fixes #285)

  • Participants
  • Parent commits 0a45ae3

Comments (0)

Files changed (2)

 
 * Support current snapshots of CPython 3.3.
 * Distribute now recognizes README.rst as a standard, default readme file.
+* Exclude 'encodings' modules when removing modules from sys.modules.
+  Workaround for #285.
 
 ------
 0.6.26

File setuptools/sandbox.py

     finally:
         pkg_resources.__setstate__(pr_state)
         sys.modules.update(save_modules)
-        for key in list(sys.modules):
-            if key not in save_modules: del sys.modules[key]
+        # remove any modules imported within the sandbox
+        del_modules = [
+            mod_name for mod_name in sys.modules
+            if mod_name not in save_modules
+            # exclude any encodings modules. See #285
+            and not mod_name.startswith('encodings.')
+        ]
+        map(sys.modules.__delitem__, del_modules)
         os.chdir(old_dir)
         sys.path[:] = save_path
         sys.argv[:] = save_argv