[Zodb-checkins] CVS: Zope/lib/Components/ExtensionClass/src - Acquisition.c:1.54
Brian Lloyd
brian@digicool.com
Sun, 23 Dec 2001 10:12:35 -0500
Update of /cvs-repository/Zope/lib/Components/ExtensionClass/src
In directory cvs.zope.org:/tmp/cvs-serv5089
Modified Files:
Acquisition.c
Log Message:
Merged a fix that was missed back from the 2.5 branch.
=== Zope/lib/Components/ExtensionClass/src/Acquisition.c 1.53 => 1.54 ===
UNLESS(PyArg_Parse(args,"(OO)",&obj,&container)) return NULL;
+
+ if (self == WRAPPER(obj)) {
+ PyErr_SetString(PyExc_ValueError,
+ "Cannot wrap acquisition wrapper in itself (Wrapper__init__)");
+ return NULL;
+ }
+
Py_INCREF(obj);
Py_INCREF(container);
self->obj=obj;
@@ -218,6 +225,13 @@
UNLESS(self = PyObject_NEW(Wrapper, Wrappertype)) return NULL;
}
+ if (self == WRAPPER(obj)) {
+ PyErr_SetString(PyExc_ValueError,
+ "Cannot wrap acquisition wrapper in itself (newWrapper)");
+ Py_DECREF(self);
+ return NULL;
+ }
+
Py_INCREF(Wrappertype);
Py_XINCREF(obj);
Py_XINCREF(container);
@@ -430,6 +444,11 @@
{
if (isWrapper(self->obj))
{
+ if (self == WRAPPER(self->obj)) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Recursion detected in acquisition wrapper");
+ return NULL;
+ }
if ((r=Wrapper_findattr(WRAPPER(self->obj),
oname, filter, extra, orig, 1,