[pypy-commit] pypy cpyext-cleanup: Call the right version of rawrefcount.init() when translating

rlamy pypy.commits at gmail.com
Thu Jan 5 11:21:57 EST 2017


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: cpyext-cleanup
Changeset: r89381:5fa79126d59f
Date: 2017-01-05 16:21 +0000
http://bitbucket.org/pypy/pypy/changeset/5fa79126d59f/

Log:	Call the right version of rawrefcount.init() when translating

diff --git a/pypy/module/cpyext/state.py b/pypy/module/cpyext/state.py
--- a/pypy/module/cpyext/state.py
+++ b/pypy/module/cpyext/state.py
@@ -77,9 +77,6 @@
             else:
                 pyobj_dealloc_action = PyObjDeallocAction(space)
                 self.dealloc_trigger = lambda: pyobj_dealloc_action.fire()
-                rawrefcount.init(
-                    llhelper(rawrefcount.RAWREFCOUNT_DEALLOC_TRIGGER,
-                    self.dealloc_trigger))
 
     def build_api(self):
         """NOT_RPYTHON
@@ -106,6 +103,12 @@
         from pypy.module.cpyext.api import INIT_FUNCTIONS
 
         if we_are_translated():
+            if space.config.translation.gc != "boehm":
+                # This must be called in RPython, the untranslated version
+                # does something different. Sigh.
+                rawrefcount.init(
+                    llhelper(rawrefcount.RAWREFCOUNT_DEALLOC_TRIGGER,
+                    self.dealloc_trigger))
             self.builder.attach_all(space)
 
         setup_new_method_def(space)


More information about the pypy-commit mailing list