[New-bugs-announce] [issue17800] Expose __del__ when tp_del is populated from C code
Nick Coghlan
report at bugs.python.org
Sat Apr 20 08:38:21 CEST 2013
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't be populated from C code (that will use tp_dealloc instead), but there's now at least one case where it *is* populated from C (generators), which means it behaves *as if* __del__ is defined (since the interpreter actually checks the tp_del slot), but *looks* like __del__ *isn't* defined (since there is no wrapper created).
Independent of the memory leak concerns with generators defining tp_del, it would be better if a wrapper function was defined so the existence of the method was at least visible from Python code.
----------
components: Interpreter Core
messages: 187409
nosy: ncoghlan
priority: low
severity: normal
stage: needs patch
status: open
title: Expose __del__ when tp_del is populated from C code
type: enhancement
versions: Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17800>
_______________________________________
More information about the New-bugs-announce
mailing list