Commit 216ef67f authored by Jim Fulton's avatar Jim Fulton

Applied (slightly modified) patch submitted by John Heintz that fixes

a bug that caused ExtensionClasses with __call_method__ hook to fail
to call unbound CMethods.  Thanks!
parent ff7edde1
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. DAMAGE.
$Id: ExtensionClass.c,v 1.42 2001/01/10 18:49:16 jim Exp $ $Id: ExtensionClass.c,v 1.43 2001/01/25 21:29:15 jim Exp $
If you have questions regarding this software, If you have questions regarding this software,
contact: contact:
...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] = ...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] =
" - They provide access to unbound methods,\n" " - They provide access to unbound methods,\n"
" - They can be called to create instances.\n" " - They can be called to create instances.\n"
"\n" "\n"
"$Id: ExtensionClass.c,v 1.42 2001/01/10 18:49:16 jim Exp $\n" "$Id: ExtensionClass.c,v 1.43 2001/01/25 21:29:15 jim Exp $\n"
; ;
#include <stdio.h> #include <stdio.h>
...@@ -533,12 +533,13 @@ CMethod_call(CMethod *self, PyObject *args, PyObject *kw) ...@@ -533,12 +533,13 @@ CMethod_call(CMethod *self, PyObject *args, PyObject *kw)
) )
{ {
PyObject *rest=0; PyObject *rest=0;
UNLESS (rest=PySequence_GetSlice(args,1,size)) return NULL;
if (HasMethodHook(first) && if (HasMethodHook(first) &&
self->doc != hook_mark /* This check prevents infinite recursion */ self->doc != hook_mark /* This check prevents infinite recursion */
) )
return callCMethodWithHook(self,first,args,kw); ASSIGN(rest, callCMethodWithHook(self, first, rest, kw) );
UNLESS(rest=PySequence_GetSlice(args,1,size)) return NULL; else
ASSIGN(rest,call_cmethod(self,first,rest,kw)); ASSIGN(rest, call_cmethod(self, first, rest, kw) );
return rest; return rest;
} }
} }
...@@ -3527,7 +3528,7 @@ void ...@@ -3527,7 +3528,7 @@ void
initExtensionClass() initExtensionClass()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.42 $"; char *rev="$Revision: 1.43 $";
PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL); PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL);
PMethodType.ob_type=&PyType_Type; PMethodType.ob_type=&PyType_Type;
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. DAMAGE.
$Id: ExtensionClass.c,v 1.42 2001/01/10 18:49:16 jim Exp $ $Id: ExtensionClass.c,v 1.43 2001/01/25 21:29:15 jim Exp $
If you have questions regarding this software, If you have questions regarding this software,
contact: contact:
...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] = ...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] =
" - They provide access to unbound methods,\n" " - They provide access to unbound methods,\n"
" - They can be called to create instances.\n" " - They can be called to create instances.\n"
"\n" "\n"
"$Id: ExtensionClass.c,v 1.42 2001/01/10 18:49:16 jim Exp $\n" "$Id: ExtensionClass.c,v 1.43 2001/01/25 21:29:15 jim Exp $\n"
; ;
#include <stdio.h> #include <stdio.h>
...@@ -533,12 +533,13 @@ CMethod_call(CMethod *self, PyObject *args, PyObject *kw) ...@@ -533,12 +533,13 @@ CMethod_call(CMethod *self, PyObject *args, PyObject *kw)
) )
{ {
PyObject *rest=0; PyObject *rest=0;
UNLESS (rest=PySequence_GetSlice(args,1,size)) return NULL;
if (HasMethodHook(first) && if (HasMethodHook(first) &&
self->doc != hook_mark /* This check prevents infinite recursion */ self->doc != hook_mark /* This check prevents infinite recursion */
) )
return callCMethodWithHook(self,first,args,kw); ASSIGN(rest, callCMethodWithHook(self, first, rest, kw) );
UNLESS(rest=PySequence_GetSlice(args,1,size)) return NULL; else
ASSIGN(rest,call_cmethod(self,first,rest,kw)); ASSIGN(rest, call_cmethod(self, first, rest, kw) );
return rest; return rest;
} }
} }
...@@ -3527,7 +3528,7 @@ void ...@@ -3527,7 +3528,7 @@ void
initExtensionClass() initExtensionClass()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.42 $"; char *rev="$Revision: 1.43 $";
PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL); PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL);
PMethodType.ob_type=&PyType_Type; PMethodType.ob_type=&PyType_Type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment