[C++-sig] Strange boost python error message (and solution)

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Wed May 24 18:12:55 CEST 2006

--- David Abrahams <dave at boost-consulting.com> wrote:

> > possible to do the following (highlighted with //****...):
> > ...
> >       //*************************************************************
> >       if (slot == f) // already registered with the same function, do
> >                      // nothing?
> >       {
> >           return;
> >       }
> >       //*************************************************************
> ...
> That's a very nice solution, consistent with other parts of Boost.Python.

>From boost/python/converter/to_python_function_type.hpp:

typedef PyObject* (*to_python_function_t)(void const*);

I am still worried about the function pointer comparison. It seems unlikely to
me that the double-registration originates from a single extension; that would
be very easy to avoid. If the same to_python converter is defined in two
different extensions, are we sure that the address comparison is meaningful? I
am thinking the machine code for the function exists independently in each
extension, i.e. has two different addresses. Does the dynamic loader eliminate
the duplication on all platforms? Is the behavior the same with, e.g.

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the Cplusplus-sig mailing list