[Zope-Checkins] CVS: Zope3/lib/python/Zope/Security - _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/Security
In directory cvs.zope.org:/tmp/cvs-serv31486/Security
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/Security/_Proxy.c 1.2 => 1.3 ===
PyObject *checker = Proxy_GetChecker(self);
- if (check(checker, "__setitem__", object))
- return PyObject_SetItem(object, key, value);
+ if (value == NULL) {
+ if (check(checker, "__delitem__", object))
+ return PyObject_DelItem(object, key);
+ }
+ else {
+ if (check(checker, "__setitem__", object))
+ return PyObject_SetItem(object, key, value);
+ }
return -1;
}