zopefoundation / Acquisition

Acquisition is a mechanism that allows objects to obtain attributes from the containment hierarchy they're in.
Other
12 stars 12 forks source link

Fix process of reference count during GC #21

Closed y-fujisaki2 closed 7 years ago

y-fujisaki2 commented 7 years ago

When we subtract reference counter of an object, the destructor is automatically called if the value of counter is 0. At the same time an error occurs, as the GC executed while the destructor is still in running phase. To eliminate the error, we have added below program which exclude objects from GC in the destructor in line 4.

static void Wrapper_dealloc(Wrapper self) { PyObject_GC_UnTrack((PyObject )self); //Add this line to eliminate self from GC Wrapper_clear(self); self->ob_type->tp_free((PyObject*)self); }

Patch: Acquisition.zip

stephan-hof commented 7 years ago

Thanks for reporting. Issue is fixed via pull-request #22

y-fujisaki2 commented 7 years ago

Thanks so much for quickly marging this fix.