[Zope3-checkins] CVS: Zope3/src/zope/context - wrapper.c:1.25

Anthony Baxter anthony@interlink.com.au
Sun, 13 Jul 2003 09:45:58 -0400


Update of /cvs-repository/Zope3/src/zope/context
In directory cvs.zope.org:/tmp/cvs-serv8752

Modified Files:
	wrapper.c 
Log Message:
ContextMethod(ContextMethod(func)) would bomb out with a SystemError.
Fixed by applying the same patch that was applied to Python2.3's classmethod.
Also added a simple test. Note that if you've do a cvs up and get a failure,
make sure you've rebuilt the C code module in src/zope/context/wrapper.c


=== Zope3/src/zope/context/wrapper.c 1.24 => 1.25 ===
--- Zope3/src/zope/context/wrapper.c:1.24	Sat Jun  7 09:13:39 2003
+++ Zope3/src/zope/context/wrapper.c	Sun Jul 13 09:45:23 2003
@@ -353,6 +353,11 @@
 
     if (!PyArg_UnpackTuple(args, "ContextMethod", 1, 1, &callable))
         return -1;
+    if (!PyCallable_Check(callable)) {
+        PyErr_Format(PyExc_TypeError, "'%s' object is not callable",
+             callable->ob_type->tp_name);
+        return -1;
+    }
     Py_INCREF(callable);
     cm->cm_callable = callable;
     return 0;