[Zope-Checkins] CVS: Zope3/lib/python/Zope/ContextWrapper - proxy.c:1.1.4.3
Fred L. Drake, Jr.
fdrake@acm.org
Thu, 6 Jun 2002 12:49:29 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/ContextWrapper
In directory cvs.zope.org:/tmp/cvs-serv21818
Modified Files:
Tag: Zope-3x-branch
proxy.c
Log Message:
Since the __new__ methods parse their arguments, make sure they check *all*
their arguments, not just the positional args.
Added new tests that check their expected behavior.
=== Zope3/lib/python/Zope/ContextWrapper/proxy.c 1.1.4.2 => 1.1.4.3 ===
if (PyArg_UnpackTuple(args, "__new__", 1, 1, &object)) {
+ if (kwds != NULL && PyDict_Size(kwds) != 0) {
+ PyErr_SetString(PyExc_TypeError,
+ "proxy.__new__ does not accept keyword args");
+ return NULL;
+ }
result = PyType_GenericNew(type, args, kwds);
if (result != NULL) {
ProxyObject *wrapper = (ProxyObject *) result;
@@ -41,6 +46,11 @@
if (PyArg_UnpackTuple(args, "__init__", 1, 1, &object)) {
ProxyObject *wrapper = (ProxyObject *)self;
+ if (kwds != NULL && PyDict_Size(kwds) != 0) {
+ PyErr_SetString(PyExc_TypeError,
+ "proxy.__init__ does not accept keyword args");
+ return NULL;
+ }
/* If the object in this proxy is not the one we
* received in args, replace it with the new one.
*/