Persistence versus __del__

Bug #143338 reported by Tim Peters
Affects Status Importance Assigned to Milestone

Bug Description

If a persistent object has a __del__ method, bad things can happen. The combination probably ought to be disallowed upon an attempt to create a persistent class with a __del__ method. More info in this thread:


Unfortunately, that spills in to March too.

Tags: bug database
Revision history for this message
Tim Peters (tim-one) wrote :

Changes: revised title, new comment

Repaired typo in Title.

Revision history for this message
Florent Guillaume (efge) wrote :

The March thread continues at

For the record I'll paste the traceback here:

  File "/opt/zope/lib/python/ZPublisher/", line 92, in publish
    object=request.traverse(path, validated_hook=validated_hook)
  File "/opt/zope/lib/python/ZPublisher/", line 231, in traverse
  File "/opt/zope/lib/python/ZODB/", line 48, in __bobo_traverse__
  File "/opt/zope/lib/python/ZODB/", line 504, in open
  File "/opt/zope/lib/python/Products/ZODBMountPoint/", line 180, in _setDB
  File "/opt/zope/lib/python/Products/ZODBMountPoint/", line 176, in _setDB
  File "/opt/zope/lib/python/ZODB/", line 257, in _setDB
  File "/opt/zope/lib/python/ZODB/", line 552, in _flush_invalidations
  File "/appli/zeo/zeocli-", line 125, in __del__
  File "/opt/zope/lib/python/ZODB/", line 599, in setstate
    invalid = self._is_invalidated(obj)
  File "/opt/zope/lib/python/ZODB/", line 617, in _is_invalidated

The __del__ method at line 125 basically just does
  foo =

Revision history for this message
Tim Peters (tim-one) wrote :


The attached deadlocks reliably (ZODB 3.2.6b1). Alas, while it uses a __del__ method to do so, it's on a non-persistent object: the potential problems are worse than just persistent classes with __del__.

Revision history for this message
Hanno Schlichting (hannosch) wrote :

This looks like it should affect both Persitence and persistent.

affects: zope2 → zodb
Revision history for this message
Jim Fulton (jim-zope) wrote :

I'm find with disallowing __del__, however, this will require a meta-class AFAIK.
I both love and hate meta classes. :) I want to save them for when I really need then,
but I rarely really need them.

This will need to wait for the persistence redo.

Changed in zodb:
importance: Medium → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments