From: Stefan Behnel Date: Sat, 3 Aug 2013 19:43:24 +0000 (+0200) Subject: use tp_finalize instead of tp_del for Cython generators X-Git-Tag: 0.20b1~428 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4261a694a0b14f61ef3356401739d24f497d1c1f;p=platform%2Fupstream%2Fpython-cython.git use tp_finalize instead of tp_del for Cython generators --- diff --git a/Cython/Utility/Generator.c b/Cython/Utility/Generator.c index 464690c..b4c5bca 100644 --- a/Cython/Utility/Generator.c +++ b/Cython/Utility/Generator.c @@ -482,9 +482,11 @@ static void __Pyx_Generator_del(PyObject *self) { if (gen->resume_label <= 0) return ; +#if PY_VERSION_HEX < 0x03040a00 /* Temporarily resurrect the object. */ assert(self->ob_refcnt == 0); self->ob_refcnt = 1; +#endif /* Save the current exception, if any. */ __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); @@ -499,6 +501,7 @@ static void __Pyx_Generator_del(PyObject *self) { /* Restore the saved exception. */ __Pyx_ErrRestore(error_type, error_value, error_traceback); +#if PY_VERSION_HEX < 0x03040a00 /* Undo the temporary resurrection; can't use DECREF here, it would * cause a recursive call. */ @@ -532,6 +535,7 @@ static void __Pyx_Generator_del(PyObject *self) { --Py_TYPE(self)->tp_frees; --Py_TYPE(self)->tp_allocs; #endif +#endif } static PyMemberDef __pyx_Generator_memberlist[] = { @@ -604,12 +608,16 @@ static PyTypeObject __pyx_GeneratorType_type = { 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ +#if PY_VERSION_HEX >= 0x03040a00 + 0, +#else __Pyx_Generator_del, /*tp_del*/ +#endif #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif #if PY_VERSION_HEX >= 0x03040a00 - 0, /*tp_finalize*/ + __Pyx_Generator_del, /*tp_finalize*/ #endif };