[Zope-Checkins] SVN: Zope/branches/philikon-aq-and-__parent__/lib/python/Acquisition/tests.py Added a test to Acquisition that shows the current segmentation fault problem, when Acquisition goes in circles.

Hanno Schlichting plone at hannosch.info
Sun May 6 13:41:06 EDT 2007


Log message for revision 75578:
  Added a test to Acquisition that shows the current segmentation fault problem, when Acquisition goes in circles.
  

Changed:
  U   Zope/branches/philikon-aq-and-__parent__/lib/python/Acquisition/tests.py

-=-
Modified: Zope/branches/philikon-aq-and-__parent__/lib/python/Acquisition/tests.py
===================================================================
--- Zope/branches/philikon-aq-and-__parent__/lib/python/Acquisition/tests.py	2007-05-06 16:49:33 UTC (rev 75577)
+++ Zope/branches/philikon-aq-and-__parent__/lib/python/Acquisition/tests.py	2007-05-06 17:41:06 UTC (rev 75578)
@@ -1998,6 +1998,37 @@
       True
     """
 
+def test___parent__aq_parent_cycles():
+    """
+    Sometimes __parent__ pointers and normal Acquisition can cause aq_chains
+    to go in circles:
+
+      >>> class Expl(Acquisition.Explicit):
+      ...     hello = 'world'
+
+      >>> class Expl2(Acquisition.Explicit):
+      ...     hello = 'world2'
+
+      >>> x = Expl()
+      >>> y = Expl2().__of__(x)
+      >>> x.__parent__ = y
+
+      >>> x.__parent__.aq_base is y.aq_base
+      True
+
+      >>> x.__parent__.__parent__ is x
+      True
+
+      >>> Acquisition.aq_get(x, 'hello')
+      'world'
+
+      XXX This causes a segmentation fault, as some tests in Products.Five do
+      as well
+      >>> Acquisition.aq_get(x, 'hello2')
+      
+
+    """
+
 import unittest
 from zope.testing.doctest import DocTestSuite
 



More information about the Zope-Checkins mailing list