[Zope-Checkins] CVS: Zope3/lib/python/Zope/ContextWrapper - wrapper.c:1.12.2.6
Fred Drake Jr
fdrake@acm.org
Fri, 30 Nov 2001 16:53:10 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/ContextWrapper
In directory cvs.zope.org:/tmp/cvs-serv21470
Modified Files:
Tag: Zope-3x-branch
wrapper.c
Log Message:
wrap_richcompare(): Avoid unnecessary function calls when unwrapping the
objects being compared.
=== Zope3/lib/python/Zope/ContextWrapper/wrapper.c 1.12.2.5 => 1.12.2.6 ===
-static PyObject *api_getbaseobject(PyObject *obj);
+staticforward PyTypeObject WrapperType;
static PyObject *
empty_tuple = NULL;
@@ -85,8 +85,12 @@
static PyObject *
wrap_richcompare(PyObject* self, PyObject* other, int op)
{
- self = api_getbaseobject(self);
- other = api_getbaseobject(other);
+ while (Wrapper_Check(self)) {
+ self = Wrapper_GetObject(self);
+ }
+ while (Wrapper_Check(other)) {
+ other = Wrapper_GetObject(other);
+ }
return PyObject_RichCompare(self, other, op);
}
@@ -282,7 +286,7 @@
* be associated with the wrapper itself.
*/
-static PyTypeObject
+statichere PyTypeObject
WrapperType = {
PyObject_HEAD_INIT(NULL)
0,