[pypy-commit] pypy py3.3-bootstrap: A check (it fails when running almost any test): during space.startup(),

arigo noreply at buildbot.pypy.org
Wed Oct 7 13:25:10 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.3-bootstrap
Changeset: r80017:88a921f5ae6b
Date: 2015-10-07 13:25 +0200
http://bitbucket.org/pypy/pypy/changeset/88a921f5ae6b/

Log:	A check (it fails when running almost any test): during
	space.startup(), we must not call "import encodings". This is too
	early; the stdlib path will only be set up afterwards.

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -420,6 +420,7 @@
                 raise
             if isinstance(w_mod, Module) and not w_mod.startup_called:
                 w_mod.init(self)
+        self._basic_startup_done = True
 
     def finish(self):
         self.wait_for_thread_shutdown()
diff --git a/pypy/module/_codecs/interp_codecs.py b/pypy/module/_codecs/interp_codecs.py
--- a/pypy/module/_codecs/interp_codecs.py
+++ b/pypy/module/_codecs/interp_codecs.py
@@ -163,6 +163,11 @@
     state = space.fromcache(CodecState)
     if state.codec_need_encodings:
         # registers new codecs.
+        # First, a check that we're not called very early---if we are,
+        # then after translation the code in app_main doesn't have a
+        # chance to set up the path to the stdlib.
+        if not we_are_translated():
+            assert space._basic_startup_done
         # This import uses the "builtin" import method, and is needed
         # to bootstrap the full importlib module.
         w_import = space.getattr(space.builtin, space.wrap("__import__"))


More information about the pypy-commit mailing list