Skip to content

Commit

Permalink
Added a test to Acquisition that shows the current segmentation fault…
Browse files Browse the repository at this point in the history
… problem, when Acquisition goes in circles.
  • Loading branch information
hannosch committed May 6, 2007
1 parent 12c5584 commit e2164f2
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1998,6 +1998,37 @@ def test_explicit_wrapper_has_nonwrapper_as_aq_parent():
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

Expand Down

0 comments on commit e2164f2

Please sign in to comment.