[C++-SIG] Callable.apply() throws exceptions.TypeError

Phil Austin phil at geog.ubc.ca
Wed May 10 01:40:17 CEST 2000


In the version of CXX I have (dated 2000-4-30), calling
Callable.apply() with no arguments evokes 

!             Object apply(PyObject* pargs = 0) const {
! 				return apply (Tuple(pargs));

which produces an exceptions.TypeError on my machine 
(solaris with KCC).  My quick fix was to remove the default
argment and add another override:

*** CXX_Objects.h	2000/05/09 23:33:15	1.4
--- CXX_Objects.h	2000/05/09 23:36:23
***************
*** 1773,1786 ****
                  return pyob && PyCallable_Check (pyob);
              }
              
              // Call
              Object apply(const Tuple& args) const {
                  return asObject(PyObject_CallObject(ptr(), args.ptr()));
              }
              
!             Object apply(PyObject* pargs = 0) const {
! 				return apply (Tuple(pargs));
! 			}
          }; 
          
          class Module: public Object {
--- 1773,1792 ----
                  return pyob && PyCallable_Check (pyob);
              }
              
+ 
              // Call
              Object apply(const Tuple& args) const {
                  return asObject(PyObject_CallObject(ptr(), args.ptr()));
              }
              
!             Object apply(PyObject* pargs) const {
! 		return apply (Tuple(pargs));
! 	    }
! 
!             Object apply(void) const {
!                 return asObject(PyObject_CallObject(ptr(), (PyObject*) NULL));
! 	    }
! 
          }; 
          
          class Module: public Object {


Regards, Phil








More information about the Cplusplus-sig mailing list