[Zodb-checkins] CVS: Zope/lib/Components/ExtensionClass/src - Acquisition.c:1.51.36.1
Shane Hathaway
shane@digicool.com
Fri, 14 Sep 2001 16:06:29 -0400
Update of /cvs-repository/Zope/lib/Components/ExtensionClass/src
In directory cvs.zope.org:/tmp/cvs-serv1123/ExtensionClass/src
Modified Files:
Tag: Zope-2_4-branch
Acquisition.c
Log Message:
Merge from trunk
=== Zope/lib/Components/ExtensionClass/src/Acquisition.c 1.51 => 1.51.36.1 ===
Wrapper_inContextOf(Wrapper *self, PyObject *args)
{
- PyObject *o, *c;
+ PyObject *subob, *o, *c;
int inner=1;
UNLESS(PyArg_ParseTuple(args,"O|i",&o,&inner)) return NULL;
if (inner) {
+ /* subob = self */
+ subob = OBJECT(self);
+
/* o = aq_base(o) */
while (isWrapper(o) && WRAPPER(o)->obj) o=WRAPPER(o)->obj;
/* while 1: */
while (1) {
- /* if aq_base(self) is o: return 1 */
- c = self->obj;
+ /* if aq_base(subob) is o: return 1 */
+ c = subob;
while (isWrapper(c) && WRAPPER(c)->obj) c = WRAPPER(c)->obj;
if (c == o) return PyInt_FromLong(1);
- /* self = aq_parent(aq_inner(self)) */
+ /* self = aq_inner(subob) */
/* if self is None: break */
- while (self->obj && isWrapper(self->obj)) self = WRAPPER(self->obj);
- if (self->container && isWrapper(self->container))
- self = WRAPPER(self->container);
+ if (isWrapper(subob)) {
+ self = WRAPPER(subob);
+ while (self->obj && isWrapper(self->obj))
+ self = WRAPPER(self->obj);
+ }
+ else break;
+
+ /* subob = aq_parent(self) */
+ /* if subob is None: break */
+ if (self->container)
+ subob = self->container;
else break;
}
}