Opened 17 years ago

Closed 16 years ago

Last modified 4 years ago

#3 closed Bugs (fixed)

automatic conversion and overload proble

Reported by: nobody Owned by: david_abrahams
Milestone: Component: python USE GITHUB
Version: None Severity: Problem
Keywords: Cc:


When overload is used, if functions whose parameters
use automatic conversions are declared first, the
functinos whose parameters are wrapped extension
classes do not resolve.

I attached a file which demonstrates what happens.  Two
automatic conversions are defined, on GeVector2 and
GeVector3.  Then 3 overloaded functions are defined and
exposed, the first two using the automatic conversions
from above, and the third using a simple Foo class.

When the functions using the automatic conversions are
declared after the function taking Foo as a parameter,
it all works.

Here is your test program:

import prob

f = prob.Foo()
print prob.testfoo( f )

However, the automatic conversions work between
themselves (i.e. a failed conversion to a GeVector2
when trying to convert a GeVector3 will not fail the
conversion to GeVector3).
I also found that by throwing the exception
unconditinoally at the beginning of the conversion
functions makes it work for the wrapped ext.class.
This indicates that the following code is the culprit:

   // Convert from a list of two.
   boost::python::list l = 
      from_python( p,
boost::python::type<boost::python::list>() );

runnign that makes the subsequent intent to convert to
a wrapped class fail somehow.

Any idea?

Change History (6)

comment:1 Changed 17 years ago by blais

Logged In: YES 

sorry, this one should go to dave_abrahams

comment:2 Changed 17 years ago by blais

Logged In: YES 

ouch... my file didn't attach, file can be found at


comment:3 Changed 16 years ago by david_abrahams

Status: assignedclosed

comment:4 Changed 9 years ago by Robert Ramey

Resolution: Nonefixed

(In [62785]) fix #3 for version_type

comment:5 Changed 9 years ago by Robert Ramey

(In [62787]) fix #3 for version_type

comment:6 Changed 4 years ago by anonymous

Severity: Problem

hello world

Note: See TracTickets for help on using tickets.