[pypy-svn] r25400 - in pypy/dist/pypy/translator/c: . test

mwh at codespeak.net mwh at codespeak.net
Wed Apr 5 17:40:53 CEST 2006


Author: mwh
Date: Wed Apr  5 17:40:52 2006
New Revision: 25400

Modified:
   pypy/dist/pypy/translator/c/database.py
   pypy/dist/pypy/translator/c/test/test_genc.py
Log:
(pedronis, mwh)
make the default selection of gcpolicy in database.py consider --gc
fix embarrassing typo in test_genc


Modified: pypy/dist/pypy/translator/c/database.py
==============================================================================
--- pypy/dist/pypy/translator/c/database.py	(original)
+++ pypy/dist/pypy/translator/c/database.py	Wed Apr  5 17:40:52 2006
@@ -14,6 +14,7 @@
 from pypy.translator.c.support import log
 from pypy.translator.c.extfunc import do_the_getting
 from pypy.translator.c.exceptiontransform import ExceptionTransformer
+from pypy import conftest
 
 # ____________________________________________________________
 
@@ -39,7 +40,20 @@
             self.pyobjmaker = PyObjMaker(self.namespace, self.get, translator, instantiators)
         if gcpolicy is None:
             from pypy.translator.c import gc
-            gcpolicy = gc.RefcountingGcPolicy
+            polname = conftest.option.gcpolicy
+            if polname is not None:
+                if polname == 'boehm':
+                    gcpolicy = gc.BoehmGcPolicy
+                elif polname == 'ref':
+                    gcpolicy = gc.RefcountingGcPolicy
+                elif polname == 'none':
+                    gcpolicy = gc.NoneGcPolicy
+                elif polname == 'framework':
+                    gcpolicy = gc.FrameworkGcPolicy
+                else:
+                    assert False, "unknown gc policy %r"%polname
+            else:
+                gcpolicy = gc.RefcountingGcPolicy
         if translator is None or translator.rtyper is None:
             self.exctransformer = None
         else:

Modified: pypy/dist/pypy/translator/c/test/test_genc.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_genc.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_genc.py	Wed Apr  5 17:40:52 2006
@@ -37,20 +37,6 @@
     t.buildrtyper().specialize()
     if backendopt:
         backend_optimizations(t)
-    if gcpolicy is None:
-        polname = conftest.option.gcpolicy
-        if polname is not None:
-            from pypy.translator.c import gc
-            if polname == 'boehm':
-                gcpolicy = gc.BoehmGcPolicy
-            elif polname == 'ref':
-                gcpolicy = gc.RefcountingGcPolicy
-            elif polname == 'none':
-                gcpolicy = gc.NoneGcPolicy
-            elif polname == 'framework':
-                gcpolicy = gc.FrameworkGcPolicy
-            else:
-                assert False, "unknown gc policy %r"%polname
     db = LowLevelDatabase(t, gcpolicy=gcpolicy)
     entrypoint = db.get(pyobjectptr(fn))
     db.complete()
@@ -315,7 +301,7 @@
     assert f1() == 1
 
 # this test shows if we have a problem with refcounting PyObject
-if conftest.option.gc == 'boehm':
+if conftest.option.gcpolicy == 'boehm':
     def test_refcount_pyobj():
         from pypy.rpython.lltypesystem.lloperation import llop
         def prob_with_pyobj(b):



More information about the Pypy-commit mailing list