[ZODB-Dev] Re: [Zodb-checkins] Changed the strategy for managing savepoints.

Jim Fulton jim at zope.com
Wed Apr 27 11:23:21 EDT 2005


Florent Guillaume wrote:
> Jim Fulton  <jim at zope.com> wrote:
> 
>>Modified: ZODB/branches/3.4/src/transaction/_transaction.py
>>===================================================================
>>--- ZODB/branches/3.4/src/transaction/_transaction.py	2005-04-27 10:18:40 UTC
>>(rev 30199)
>>+++ ZODB/branches/3.4/src/transaction/_transaction.py	2005-04-27 11:20:56 UTC
>>+    # If savepoints are used, keep a weak key dict of them
>>+    _savepoints = {}
> 
> 
> Isn't it dangerous to have this mutable class attribute? Later on the
> code does:
> 
> 
>>+        if self._savepoints is None:
>>+            self._savepoints = {}
>>+        self._savepoints[ref] = self._savepoint_index
> 
> 
> And also some dels.
> 
> So I'd say you meant to have None for the class attribute
> initialization.

Eek. Yup. Good catch. Thanks.

For a moment, I was surprised that the tests passed.
It appears that I was saved by the fact that items get removed
when the savepoints are garbage collected.

I'll check in a fix when the tests finish running.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the ZODB-Dev mailing list