Author: Matti Picus <matti.pi...@gmail.com>
Branch: jit-hooks-can-be-disabled
Changeset: r94206:bc36eabcc716
Date: 2018-04-01 08:43 +0300
http://bitbucket.org/pypy/pypy/changeset/bc36eabcc716/

Log:    close merged branch

diff --git a/pypy/module/cpyext/pyobject.py b/pypy/module/cpyext/pyobject.py
--- a/pypy/module/cpyext/pyobject.py
+++ b/pypy/module/cpyext/pyobject.py
@@ -60,7 +60,12 @@
 
     def _cpyext_attach_pyobj(self, space, py_obj):
         self._cpy_ref = py_obj
-        rawrefcount.create_link_pyobj(self, py_obj)
+        if type(self) is cls:
+            rawrefcount.create_link_pyobj(self, py_obj)
+        else:
+            # optimization of create_link_pyobj() doesn't work for
+            # interp-level subclasses!
+            rawrefcount.create_link_pypy(self, py_obj)
     cls._cpyext_attach_pyobj = _cpyext_attach_pyobj
 
 add_direct_pyobj_storage(W_BaseCPyObject)
@@ -128,9 +133,6 @@
                             w_type)
             raise
         track_reference(space, obj, w_obj)
-        if w_type.flag_cpytype:
-            assert isinstance(w_obj, W_BaseCPyObject)
-            w_obj._cpy_ref = obj
         return w_obj
 
 typedescr_cache = {}
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to