[pypy-commit] pypy default: Forbid the use of None in translated versions.

arigo noreply at buildbot.pypy.org
Sun Sep 18 12:25:08 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r47322:addcee4d3bfe
Date: 2011-09-18 10:38 +0200
http://bitbucket.org/pypy/pypy/changeset/addcee4d3bfe/

Log:	Forbid the use of None in translated versions.

diff --git a/pypy/rlib/rstacklet.py b/pypy/rlib/rstacklet.py
--- a/pypy/rlib/rstacklet.py
+++ b/pypy/rlib/rstacklet.py
@@ -1,4 +1,5 @@
 from pypy.rlib import _rffi_stacklet as _c
+from pypy.rlib.objectmodel import we_are_translated
 from pypy.rpython.lltypesystem import lltype, llmemory
 
 DEBUG = False
@@ -7,7 +8,7 @@
 class StackletThread(object):
 
     def __init__(self, config):
-        self._gcrootfinder = _getgcrootfinder(config)
+        self._gcrootfinder = _getgcrootfinder(config, we_are_translated())
         self._thrd = _c.newthread()
         if not self._thrd:
             raise MemoryError
@@ -62,7 +63,10 @@
 
 # ____________________________________________________________
 
-def _getgcrootfinder(config):
+def _getgcrootfinder(config, translated):
+    if translated:
+        assert config is not None, ("you have to pass a valid config, "
+                                    "e.g. from 'driver.config'")
     if (config is None or
         config.translation.gc in ('ref', 'boehm', 'none')):   # for tests
         gcrootfinder = 'n/a'


More information about the pypy-commit mailing list