This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients Anssi.Kääriäinen, amaury.forgeotdarc, benjamin.peterson, docs@python, gvanrossum, isoschiz, ncoghlan, vstinner
Date 2013-04-19.16:03:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Adding Guido because this appears to be due to a longstanding difference between the handling of tp_del and most other slots

Specifically, the reason for the odd behaviour appears to be that generator objects define tp_del [1] (which is what the cyclic gc *really* looks for), but while defining __del__ in Python will populate tp_del in the type slots, defining tp_del directly in a builtin or extension type doesn't create an exposed __del__ at the Python level (there's no wrapper function identified in the slot definition).

So, at the very least, the fact that builtin and extension types can define tp_del without creating a visible __del__ method needs to be documented as a CPython implementation detail.

However, I'm not sure we actually have a good *reason* for tp_del failing to generate __del__ automatically - it's been that way since Guido implemented it [2], but Guido's comment in that commit message about not needing a wrapper because types written in C can't define tp_del is clearly no longer accurate.

Date User Action Args
2013-04-19 16:03:24ncoghlansetrecipients: + ncoghlan, gvanrossum, amaury.forgeotdarc, vstinner, benjamin.peterson, docs@python, Anssi.Kääriäinen, isoschiz
2013-04-19 16:03:24ncoghlansetmessageid: <>
2013-04-19 16:03:24ncoghlanlinkissue17468 messages
2013-04-19 16:03:24ncoghlancreate