[Zodb-checkins] CVS: ZODB3/ZODB/tests - testUtils.py:1.5

Jeremy Hylton jeremy at zope.com
Thu Dec 11 00:16:52 EST 2003


Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv17567/ZODB/tests

Modified Files:
	testUtils.py 
Log Message:
Ignore descriptors in persistent_id() calls.

Apparent fix for the bug Sidnei reported today.  He didn't have a
simple test case, rather reported that starting Zope with Formulator
caused a crash.  I think this will fix the problem.

We had to do the same thing in Python code in ZODB4, but weren't
worrying about performance there.


=== ZODB3/ZODB/tests/testUtils.py 1.4 => 1.5 ===
--- ZODB3/ZODB/tests/testUtils.py:1.4	Thu Oct  2 14:17:17 2003
+++ ZODB3/ZODB/tests/testUtils.py	Thu Dec 11 00:16:50 2003
@@ -15,6 +15,8 @@
 
 import random
 import unittest
+from persistent import Persistent
+import ZODB.coptimizations
 
 NUM = 100
 
@@ -43,6 +45,13 @@
         self.assertEquals(U64("\000\000\000\000\000\000\000\001"), 1)
         self.assertEquals(u64("\000\000\000\001\000\000\000\000"), 1L<<32)
         self.assertEquals(U64("\000\000\000\001\000\000\000\000"), 1L<<32)
+
+    def checkPersistentIdHandlesDescriptor(self):
+        class P(Persistent):
+            pass
+        L = []
+        pid = ZODB.coptimizations.new_persistent_id(None, L)
+        pid(P)
 
 def test_suite():
     return unittest.makeSuite(TestUtils, 'check')




More information about the Zodb-checkins mailing list