[pypy-commit] pypy cpyext-leakchecking: Temporarily disable tp_mro and tp_dict slots to avoid ref cycles that prevent types from being collected
rlamy
pypy.commits at gmail.com
Sat Jul 22 13:30:42 EDT 2017
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: cpyext-leakchecking
Changeset: r91955:0d18cd6d4afc
Date: 2017-07-22 18:32 +0200
http://bitbucket.org/pypy/pypy/changeset/0d18cd6d4afc/
Log: Temporarily disable tp_mro and tp_dict slots to avoid ref cycles
that prevent types from being collected
diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py
--- a/pypy/module/cpyext/typeobject.py
+++ b/pypy/module/cpyext/typeobject.py
@@ -674,9 +674,9 @@
obj_pto = rffi.cast(PyTypeObjectPtr, obj)
base_pyo = rffi.cast(PyObject, obj_pto.c_tp_base)
Py_DecRef(space, obj_pto.c_tp_bases)
- Py_DecRef(space, obj_pto.c_tp_mro)
+ #Py_DecRef(space, obj_pto.c_tp_mro)
Py_DecRef(space, obj_pto.c_tp_cache) # let's do it like cpython
- Py_DecRef(space, obj_pto.c_tp_dict)
+ #Py_DecRef(space, obj_pto.c_tp_dict)
if obj_pto.c_tp_flags & Py_TPFLAGS_HEAPTYPE:
heaptype = rffi.cast(PyHeapTypeObject, obj)
Py_DecRef(space, heaptype.c_ht_name)
@@ -928,7 +928,7 @@
"""
Sets up other attributes, when the interpreter type has been created.
"""
- pto.c_tp_mro = make_ref(space, space.newtuple(w_obj.mro_w))
+ #pto.c_tp_mro = make_ref(space, space.newtuple(w_obj.mro_w))
base = pto.c_tp_base
if base:
inherit_special(space, pto, base)
@@ -951,7 +951,7 @@
w_dict = w_obj.getdict(space)
# pass in the w_obj to convert any values that are
# unbound GetSetProperty into bound PyGetSetDescrObject
- pto.c_tp_dict = make_ref(space, w_dict, w_obj)
+ #pto.c_tp_dict = make_ref(space, w_dict, w_obj)
@cpython_api([PyTypeObjectPtr, PyTypeObjectPtr], rffi.INT_real, error=CANNOT_FAIL)
def PyType_IsSubtype(space, a, b):
More information about the pypy-commit
mailing list