Commit 3daf326d authored by Hanno Schlichting's avatar Hanno Schlichting

First attempt to fix 'Acquisition problem' when encountering cyclic...

First attempt to fix 'Acquisition problem' when encountering cyclic hierarchies via __parent__ pointers. [hannosch, nouri]
parent e2164f2b
......@@ -574,7 +574,16 @@ Wrapper_acquire(Wrapper *self, PyObject *oname,
{
ASSIGN(self->container, newWrapper(self->container, r,
(PyTypeObject*)&Wrappertype));
/* Don't try to get any attributes when the parent object of the
parent object is the same as the object itself. */
if (WRAPPER(r)->obj==WRAPPER(self)->obj) {
Py_DECREF(r);
PyErr_SetObject(PyExc_AttributeError,oname);
return NULL;
}
Py_DECREF(r); /* don't need __parent__ anymore */
r=Wrapper_findattr((Wrapper*)self->container,
oname, filter, extra, orig, sob, sco, explicit,
containment);
......
......@@ -2010,11 +2010,9 @@ def test___parent__aq_parent_cycles():
... hello = 'world2'
>>> x = Expl()
>>> y = Expl2().__of__(x)
>>> y = Expl2()
>>> x.__parent__ = y
>>> x.__parent__.aq_base is y.aq_base
True
>>> y.__parent__ = x
>>> x.__parent__.__parent__ is x
True
......@@ -2022,11 +2020,10 @@ def test___parent__aq_parent_cycles():
>>> 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')
>>> Acquisition.aq_get(x, 'hello2') #doctest:+ELLIPSIS
Traceback (most recent call last):
...
AttributeError: hello2
"""
import unittest
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment