[Zope3-checkins] CVS: Zope3/src/zope/proxy/context - wrapper.c:1.14
Steve Alexander
steve@cat-box.net
Mon, 12 May 2003 04:50:38 -0400
Update of /cvs-repository/Zope3/src/zope/proxy/context
In directory cvs.zope.org:/tmp/cvs-serv22130/src/zope/proxy/context
Modified Files:
wrapper.c
Log Message:
Check for __class__ on getattr only when the objecttype is ContextAware.
We don't need to check this when the object's type is not ContextAware,
as __class__ will not be a ContextDescriptor.
=== Zope3/src/zope/proxy/context/wrapper.c 1.13 => 1.14 ===
--- Zope3/src/zope/proxy/context/wrapper.c:1.13 Thu May 8 05:39:21 2003
+++ Zope3/src/zope/proxy/context/wrapper.c Mon May 12 04:50:38 2003
@@ -652,11 +652,12 @@
if (descriptor != NULL &&
descriptor->ob_type->tp_descr_get != NULL &&
(PyObject_TypeCheck(descriptor, &ContextDescriptorType) ||
- PyObject_TypeCheck(wrapped, &ContextAwareType)) &&
- ! (PyString_Check(name)
- && strcmp(PyString_AS_STRING(name), "__class__") == 0)
- ) {
-
+ /* If object is context-aware, still don't rebind __class__.
+ */
+ (PyObject_TypeCheck(wrapped, &ContextAwareType)
+ && ! (PyString_Check(name)
+ && strcmp(PyString_AS_STRING(name), "__class__") == 0))
+ )) {
wrapped_type = (PyObject *)wrapped->ob_type;
if (wrapped_type == NULL)
return NULL;