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

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Sat May 20 08:24:31 CEST 2006


--- François Duranleau <duranlef at iro.umontreal.ca> wrote:
> > assert((slot == 0) && "Attempted to register a to_python conversion
> > function when one is already registered");
> 
> Sounds good. But also, would it be possible to detect if the same 
> to_python converter is get registered, and in such a case simply do 
> nothing and thus report no error?

If you compile with -DNDEBUG that's almost what happens. The assert is disabled
by the -DNDEBUG and a Python warning is generated via PyErr_Warn(). I believe
the warning is essential. For example, if you use two third-party packages and
each has its own, potentially incompatible std::vector wrapper, the warning
will make the conflict obvious. Without the warning it will be very had to
track down the resulting problems.

Since we have the warning, I think the assert is more confusing than helpful.
David, what do you think about removing it altogether?


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Cplusplus-sig mailing list