Author: Matti Picus <matti.pi...@gmail.com>
Branch: missing-tp_new
Changeset: r88417:4e2740f2ebdd
Date: 2016-11-16 22:27 +0200
http://bitbucket.org/pypy/pypy/changeset/4e2740f2ebdd/

Log:    extend the hack from 48bcbfaa8980 for tp_dealloc

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
@@ -503,9 +503,13 @@
     base = pto
     this_func_ptr = llhelper(subtype_dealloc.api_func.functype,
             subtype_dealloc.api_func.get_wrapper(space))
-    while base.c_tp_dealloc == this_func_ptr:
+    w_obj = from_ref(space, rffi.cast(PyObject, base))
+    # see comment in userslot.slot_tp_new, this call can also infinitely 
recurse if
+    # called with a c-extension type that inherits from a non-c-extension type
+    while base.c_tp_dealloc == this_func_ptr or w_obj.is_cpytype():
         base = base.c_tp_base
         assert base
+        w_obj = from_ref(space, rffi.cast(PyObject, base))
     dealloc = base.c_tp_dealloc
     # XXX call tp_del if necessary
     generic_cpy_call(space, dealloc, obj)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to