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

Paul F. Dubois dubois1 at llnl.gov
Wed May 10 16:58:50 CEST 2000


This is clearly an error, a rather famous one at that (it is in Meyer's
book). I will fix it as my penance.

Blushingly-yours-in-Python,

P.


> -----Original Message-----
> From: c++-sig-admin at python.org [mailto:c++-sig-admin at python.org]On
> Behalf Of Phil Austin
> Sent: Tuesday, May 09, 2000 4:40 PM
> To: Barry Scott
> Cc: c++-sig at python.org
> Subject: [C++-SIG] Callable.apply() throws exceptions.TypeError
>
>
>
> 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
>
>
>
>
>
> _______________________________________________
> C++-SIG maillist  -  C++-SIG at python.org
> http://www.python.org/mailman/listinfo/c++-sig
>





More information about the Cplusplus-sig mailing list