[pypy-commit] cffi default: fix: Lib objects didn't have the cyclic GC enabled

arigo pypy.commits at gmail.com
Wed May 25 11:30:41 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r2698:d1d89621e6f5
Date: 2016-05-25 17:31 +0200
http://bitbucket.org/cffi/cffi/changeset/d1d89621e6f5/

Log:	fix: Lib objects didn't have the cyclic GC enabled

diff --git a/c/lib_obj.c b/c/lib_obj.c
--- a/c/lib_obj.c
+++ b/c/lib_obj.c
@@ -93,7 +93,7 @@
     Py_DECREF(lib->l_dict);
     Py_DECREF(lib->l_libname);
     Py_DECREF(lib->l_ffi);
-    PyObject_Del(lib);
+    PyObject_GC_Del(lib);
 }
 
 static int lib_traverse(LibObject *lib, visitproc visit, void *arg)
@@ -578,7 +578,7 @@
     (getattrofunc)lib_getattr,                  /* tp_getattro */
     (setattrofunc)lib_setattr,                  /* tp_setattro */
     0,                                          /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT,                         /* tp_flags */
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,    /* tp_flags */
     0,                                          /* tp_doc */
     (traverseproc)lib_traverse,                 /* tp_traverse */
     0,                                          /* tp_clear */
@@ -610,7 +610,7 @@
     if (dict == NULL)
         goto err2;
 
-    lib = PyObject_New(LibObject, &Lib_Type);
+    lib = (LibObject *)PyType_GenericAlloc(&Lib_Type, 0);
     if (lib == NULL)
         goto err3;
 


More information about the pypy-commit mailing list