[pypy-commit] pypy cpyext-gc-cycle: Fixed cpyext test

stevie_92 pypy.commits at gmail.com
Fri Jan 11 05:39:14 EST 2019


Author: Stefan Beyer <home at sbeyer.at>
Branch: cpyext-gc-cycle
Changeset: r95608:ada4b64c0816
Date: 2018-08-02 10:59 +0200
http://bitbucket.org/pypy/pypy/changeset/ada4b64c0816/

Log:	Fixed cpyext test

diff --git a/pypy/module/cpyext/test/test_cpyext.py b/pypy/module/cpyext/test/test_cpyext.py
--- a/pypy/module/cpyext/test/test_cpyext.py
+++ b/pypy/module/cpyext/test/test_cpyext.py
@@ -1069,6 +1069,7 @@
             (initproc)Cycle_init,      /* tp_init */
             0,                         /* tp_alloc */
             Cycle_new,                 /* tp_new */
+            PyObject_GC_Del,           /* tp_free */
         };
         
         extern PyGC_Head *_pypy_rawrefcount_pyobj_list;
@@ -1078,6 +1079,8 @@
              Cycle *c = PyObject_GC_New(Cycle, &CycleType);
              if (c == NULL)
                  return NULL;
+                 
+             Py_INCREF(val);
              c->next = val;
 
              // TODO: check if _pypy_rawrefcount_pyobj_list contains c
@@ -1100,7 +1103,3 @@
         self.print_pyobj_list()
         c = module.create(Example(42))
         self.print_pyobj_list()
-
-        # TODO: fix rawrefcount, so that the Cycle objects are properly added
-        #       to the ALLOCATED list of leakfinder or alternatively not freed
-        #       by collect


More information about the pypy-commit mailing list