[ZODB-Dev] Tracking down a freeze (deadlock?)

Tim Peters tim at zope.com
Mon Mar 7 11:25:46 EST 2005


[Jeremy Hylton]
> I'd have to say that the vast majority of __del__ methods are read are
> unnecessary and prone to failure.  It's a necessary feature, but it's
> hard not to wonder if it has been a net loss for Python users through
> mis-use.

Clearly a net loss, from my POV.  Part of the problem is that people don't
know how to use __del__ sanely.  I explain that about once a year, but it's
one of those things people won't learn until they need to (i.e., not before
they're in trouble).  Last time around was this January:

<http://mail.python.org/pipermail/python-list/2005-January/262028.html>

>>> The ZODB documentation promisses minimal requirements to make Python
>>> classes persistent. It does *NOT* list that "__del__" must not be used.

>> I'm not sure which docs you have in mind, but I'm sure that indeed none
>> of them say this.  If we decide to disallow __del__, I'm equally unsure
>> of where to document it so that people would see it.

> Is there a rules of persistence section to Andrew's guide?  Does anyone
> read that?  One of ZODB's main goals is to minimize the work needed to
> change a regular Python class into a persistent class, but that's a goal
> not a contract.

The version on zope.org, in section 2.6, "Rules for Writing Persistent
Classes", already says:

    http://www.zope.org/Wikis/ZODB/FrontPage/guide/node3.html

    A persistent class should not have an __del__ method ...

In fact, you added that in rev 3199, 14 months ago.  This particular change
was made in ZODB 3, and didn't get backported to 3.2 versions of the guide.
Maybe it should be -- but the warning not to use __del__ has been visible in
the most obvious place I can think to put it for more than a year already.

I can add more words, and port it back to the ZODB guide that will ship in
3.2.6.  Don't know what else can be done.  At least backporting it would
give a natural excuse to mention it in 3.2.6's NEWS file.



More information about the ZODB-Dev mailing list