1. Pypy
  2. Untitled project
  3. pypy

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().

  • Participants
  • Parent commits 746c981
  • Branches default

Comments (0)

Files changed (1)

File pypy/interpreter/baseobjspace.py

View file
  • Ignore whitespace
         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