[pypy-commit] pypy default: Pre-import a few built-in modules, because some programs actually rely

arigo noreply at buildbot.pypy.org
Tue Mar 20 20:25:48 CET 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r53841:1c6dc3e6e70c
Date: 2012-03-20 20:25 +0100
http://bitbucket.org/pypy/pypy/changeset/1c6dc3e6e70c/

Log:	Pre-import a few built-in modules, because some programs actually
	rely on them to be in sys.modules :-(

diff --git a/lib-python/modified-2.7/site.py b/lib-python/modified-2.7/site.py
--- a/lib-python/modified-2.7/site.py
+++ b/lib-python/modified-2.7/site.py
@@ -550,9 +550,18 @@
                 "'import usercustomize' failed; use -v for traceback"
 
 
+def import_builtin_stuff():
+    """PyPy specific: pre-import a few built-in modules, because
+    some programs actually rely on them to be in sys.modules :-("""
+    import exceptions
+    if 'zipimport' in sys.builtin_module_names:
+        import zipimport
+
+
 def main():
     global ENABLE_USER_SITE
 
+    import_builtin_stuff()
     abs__file__()
     known_paths = removeduppaths()
     if (os.name == "posix" and sys.path and


More information about the pypy-commit mailing list