Issue1057

classification
Title: new style classes don't support __del__
Type: behaviour Severity: normal
Components: Core Versions: Jython 2.7
process
Status: open Resolution: remind
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: ajdavis, fwierzbicki, pjenvey, zyasoft
Priority: high Keywords:

Created on 2008-06-15.03:32:14 by pjenvey, last changed 2014-07-15.19:45:51 by zyasoft.

Messages
msg3287 (view) Author: Philip Jenvey (pjenvey) Date: 2008-06-15.03:32:14
old style classes create a PyFinalizableInstance when a__del__ method is 
defined (unfortunately there's even problems with that to: http://bugs.jython.org/issue1634167 )

new style classes don't do anything similar however, thus __del__ 
methods are never called

this prevents test_descr's delhoook and subtype_resurrection from 
passing
msg5246 (view) Author: Philip Jenvey (pjenvey) Date: 2009-10-20.05:10:53
Ideally we'd also warn the user if they apply a __del__ after the fact 
(see #1634167)
msg7839 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2013-02-27.17:45:31
But subtype resurrection is evil anyway ;)
msg8863 (view) Author: A. Jesse Jiryu Davis (ajdavis) Date: 2014-07-03.03:08:24
I think this is a major and longstanding departure from CPython's behavior. Can it be fixed for Jython 2.7 please?
msg8876 (view) Author: Jim Baker (zyasoft) Date: 2014-07-15.17:04:10
Blocker for 2.7, we really should fix
msg8877 (view) Author: Jim Baker (zyasoft) Date: 2014-07-15.19:45:50
Perhaps we can emulate this support via tracking with weak references, then dequeueing the corresponding reference queue and calling __del__, vs using a finalizer method that calls __del__. Such an approach would also support possible resurrection.

The tricky bit will be to figure out how to making object construction even more expensive than it already is.

As was discussed in #1634167, dynamically adding __del__ to the class of with some existing object x would not call x.__del__(), since we do not track the objects of a given class. A RuntimeWarning should be generated in this case like PyPy (http://bugs.jython.org/msg5245).
History
Date User Action Args
2014-07-15 19:45:51zyasoftsetassignee: zyasoft
messages: + msg8877
2014-07-15 17:04:27zyasoftsetpriority: normal -> high
2014-07-15 17:04:10zyasoftsetnosy: + zyasoft
messages: + msg8876
2014-07-03 03:08:25ajdavissetnosy: + ajdavis
messages: + msg8863
2013-02-27 17:45:31fwierzbickisetresolution: remind
messages: + msg7839
versions: + Jython 2.7
2009-10-20 05:10:53pjenveysetmessages: + msg5246
2009-05-23 13:54:50fwierzbickisetnosy: + fwierzbicki
2008-12-17 19:51:35fwierzbickisetpriority: normal
2008-06-15 03:33:48pjenveysettype: behaviour
2008-06-15 03:32:14pjenveycreate