Commits

Armin Rigo committed c3d240b

Add an explicit assert. Better than crashing obscurely in examples
that embed the PyPy interpreter but fail to call space.startup().

Comments (0)

Files changed (1)

pypy/interpreter/baseobjspace.py

         else:
             # translated case follows.  self.threadlocals is either from
             # 'pypy.interpreter.miscutils' or 'pypy.module.thread.threadlocals'.
-            # the result is assumed to be non-null: enter_thread() was called.
-            return self.threadlocals.get_ec()
+            # the result is assumed to be non-null: enter_thread() was called
+            # by space.startup().
+            ec = self.threadlocals.get_ec()
+            assert ec is not None
+            return ec
 
     def _freeze_(self):
         return True