Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-11-01 14:55:33


Hi Nick,

I'm just going through old emails here. Sorry it's taken so long!

I have no clue as to why you should not find the object to be callable(). It
certainly can be called!
The Python-1.5 source shows that this code is being executed:

int
PyCallable_Check(x)
 PyObject *x;
{
 if (x == NULL)
  return 0;
 if (x->ob_type->tp_call != NULL ||
     PyFunction_Check(x) ||
     PyMethod_Check(x) ||
     PyCFunction_Check(x) ||
     PyClass_Check(x))
  return 1;

and I know that the tp_call slot of the type object for bound_function
objects is set! It certainly appears to work with Python-2.2b1

Sorry,
Dave

===================================================
  David Abrahams, C++ library designer for hire
 resume: http://users.rcn.com/abrahams/resume.html

        C++ Booster (http://www.boost.org)
          email: david.abrahams_at_[hidden]
===================================================

----- Original Message -----
From: <nickm_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, September 19, 2001 8:05 AM
Subject: [boost] BPL - method is not callable

> Hi all,
>
> I am using Boost.Python to export a class library to Python,
> and I have following:
>
> def invoke(c):
> if callable(c):
> c()
> else:
> print c
> print "object not callable"
>
>
> "obj" is instance of one of the exported classes, and
> "method" is one of its methods
>
> invoke(obj.method) gives me:
>
> <class boost::python::detail::bound_function object at 0038BDE0>
> object not callable
>
> How can I correct this?
>
> Thanks
> Nikolay
>
>
> Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk