Opened 21 years ago

Closed 19 years ago

Last modified 7 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:

Description

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 by blais, 21 years ago

Logged In: YES 
user_id=10996

sorry, this one should go to dave_abrahams

comment:2 by blais, 21 years ago

Logged In: YES 
user_id=10996

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

http://www.iro.umontreal.ca/~blais/prob.cpp

sorry

comment:3 by david_abrahams, 19 years ago

Status: assignedclosed

comment:4 by Robert Ramey, 12 years ago

Resolution: Nonefixed

(In [62785]) fix #3 for version_type

comment:5 by Robert Ramey, 12 years ago

(In [62787]) fix #3 for version_type

comment:6 by anonymous, 7 years ago

Severity: Problem

hello world

Note: See TracTickets for help on using tickets.