Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #245 #246

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/greenlet/greenlet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,14 @@ green_dealloc(PyGreenlet* self)
/* Resurrected! */
_Py_NewReference((PyObject*)self);
Py_SET_REFCNT(self, refcnt);
/* Better to use tp_finalizer slot (PEP 442) and call PyObject_CallFinalizerFromDealloc,
* but that's only supported in Python 3.4+.
* The following is copied from iobase.py in CPython 2.7.
* When called from a heap type's dealloc, the type will be
* decref'ed on return (see e.g. subtype_dealloc in typeobject.c). */
if (PyType_HasFeature(Py_TYPE(self), Py_TPFLAGS_HEAPTYPE)) {
Py_INCREF(Py_TYPE(self));
}

PyObject_GC_Track((PyObject*)self);

Expand Down