[Zope-Checkins] CVS: Zope/lib/Components/ExtensionClass/src - ExtensionClass.c:1.57
Shane Hathaway
shane@cvs.zope.org
Thu, 22 Aug 2002 12:55:54 -0400
Update of /cvs-repository/Zope/lib/Components/ExtensionClass/src
In directory cvs.zope.org:/tmp/cvs-serv10350
Modified Files:
ExtensionClass.c
Log Message:
Fixed a segfault bug in the repr of extension class methods.
If self->meth is something other than a PyFunction,
for example an ExtensionClass Method object, the blind cast breaks. The
new code uses the string "(?)" if self->meth is not a function.
=== Zope/lib/Components/ExtensionClass/src/ExtensionClass.c 1.56 => 1.57 ===
--- Zope/lib/Components/ExtensionClass/src/ExtensionClass.c:1.56 Tue Jun 18 19:19:02 2002
+++ Zope/lib/Components/ExtensionClass/src/ExtensionClass.c Thu Aug 22 12:55:53 2002
@@ -826,7 +826,15 @@
char *func_name, buf[8192];
int n;
- func_name = PyString_AS_STRING(((PyFunctionObject*)self->meth)->func_name);
+ if (PyFunction_Check(self->meth)) {
+ func_name = PyString_AS_STRING(
+ ((PyFunctionObject*)self->meth)->func_name);
+ }
+ else {
+ /* self->meth is some other kind of object */
+ func_name = "(?)";
+ }
+
if (self->self) {
PyObject *repr = PyObject_Repr(self->self);
if (!repr)