[C++-sig] Re: Slice tests failing on MSVC 7.1, 8.0

Jonathan Brandmeyer jbrandmeyer at earthlink.net
Fri Aug 27 01:27:31 CEST 2004

On Thu, 2004-08-26 at 10:12, David Abrahams wrote:
> Jonathan Brandmeyer <jbrandmeyer at earthlink.net> writes:
> > According to the automated regression testers here:
> > http://www.meta-comm.com/engineering/boost-regression/developer/python_.html
> >
> > The slice test is failing on MSVC 7.1 and 8.0.  First off, do you expect
> > them to pass on these compilers?
> They're your tests, aren't they??  Don't you expect them to pass?

Yes, of course I do.  I was hoping someone more familiar with MS's
toolchain might be aware of some quirk that would lead to the error I
listed below.

> > If so, the problem is that C++ functions that take a
> > boost::python::slice argument raise a Boost.Python.AgumentError when
> > called with a Python-created slice.
> >
> > The errors in the log take the form:
> > ArgumentError: Python argument types in
> >     slice_ext.check_slice_get_indicies(slice)
> > did not match C++ signature:
> >     check_slice_get_indicies(class boost::python::slice)
> >
> > Any ideas?
> Did you register a converter that allows Python-created slices to be
> passed where boost::python::slice is required?

Not explicitly, and maybe not at all.  I expected the specialization of
object_manager_traits<> to make it Just Work.  It seems to be enough
with several other platforms and compilers.

At any rate, I managed to get the "Visual C++ Toolkit 2003" installed
and working on my system and committed a workaround.  It turns out that
the following test compiles and links fine with MSVC 7.1, but fails at
runtime when calling the exported function:

#include <boost/python.hpp>
using namespace boost::python;

void accept_slice_arg( const slice )

    def( "accept_slice_arg", &accept_slice_arg);

The workaround is to add a prototype that does not have the 'const'
qualifier in the function argument - just like with MSVC 7.0 and

Is there a reasonable way to make code like the above work for user
programs?  As far as I can tell, all of the object manager classes are


More information about the Cplusplus-sig mailing list