[Zope-Checkins] CVS: Zope3/lib/python/Zope/ContextWrapper - proxy.c:1.3

Guido van Rossum guido@python.org
Fri, 14 Jun 2002 11:24:48 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/ContextWrapper
In directory cvs.zope.org:/tmp/cvs-serv31486/ContextWrapper

Modified Files:
	proxy.c 
Log Message:
Fix the same bug in both proxy wrappers: the setitem wrapper needs to
call PyObject_DelItem() when vallue is NULL.  (And the security proxy
needs to check for __delitem__ permission.)


=== Zope3/lib/python/Zope/ContextWrapper/proxy.c 1.2 => 1.3 ===
 wrap_setitem(PyObject *self, PyObject *key, PyObject *value)
 {
-    return PyObject_SetItem(Proxy_GET_OBJECT(self), key, value);
+    if (value == NULL)
+	return PyObject_DelItem(Proxy_GET_OBJECT(self), key);
+    else
+	return PyObject_SetItem(Proxy_GET_OBJECT(self), key, value);
 }
 
 /*