Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r72422:c3d240baabb3
Date: 2014-07-11 16:22 +0200
http://bitbucket.org/pypy/pypy/changeset/c3d240baabb3/

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

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -665,8 +665,11 @@
         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
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to