[issue17800] Expose __del__ when tp_del is populated from C code

2013-04-20 Thread Benjamin Peterson
Benjamin Peterson added the comment: I don't understand why we need to invent a protocol for this. The gc module already has methods and members for introspecting the collection. I don't think the gen special casing currently needs to be generalized. (What would use it?) -- __

[issue17800] Expose __del__ when tp_del is populated from C code

2013-04-20 Thread Nick Coghlan
Nick Coghlan added the comment: Calling __del__ explicitly shouldn't be any worse than doing the same thing for any other type implemented in Python (or, in the case of generators, calling close() multiple times). What I'm mostly interested in is the "can this type cause uncollectable cycles"

[issue17800] Expose __del__ when tp_del is populated from C code

2013-04-20 Thread Barry A. Warsaw
Changes by Barry A. Warsaw : -- nosy: +barry ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue17800] Expose __del__ when tp_del is populated from C code

2013-04-20 Thread Martin Morrison
Changes by Martin Morrison : -- nosy: +isoschiz ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyt

[issue17800] Expose __del__ when tp_del is populated from C code

2013-04-20 Thread Benjamin Peterson
Benjamin Peterson added the comment: What exactly would calling such a wrapper do? -- nosy: +benjamin.peterson ___ Python tracker ___

[issue17800] Expose __del__ when tp_del is populated from C code

2013-04-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: Sounds reasonable to me. Note that it won't remove the special-casing in gcmodule.c: static int has_finalizer(PyObject *op) { if (PyGen_CheckExact(op)) return PyGen_NeedsFinalizing((PyGenObject *)op); else return op->ob_type->tp_del != N

[issue17800] Expose __del__ when tp_del is populated from C code

2013-04-20 Thread Richard Oudkerk
Richard Oudkerk added the comment: Would this mean that the destructor could be run more than once (or prematurely)? -- nosy: +sbt ___ Python tracker ___ ___

[issue17800] Expose __del__ when tp_del is populated from C code

2013-04-19 Thread Nick Coghlan
New submission from Nick Coghlan: This came up in issue 17468: currently, populating tp_del from C (as generators now do) doesn't automatically create a __del__ wrapper visible from Python. The rationale given in the initial commit is that there's no need to define a wrapper, since tp_del won'