[C++-sig] Re: Problems with functions taking string arguments on Windows

David Abrahams dave at boost-consulting.com
Wed Jun 4 15:07:44 CEST 2003


greg Landrum <greglandrum at mindspring.com> writes:

> At 11:44 AM 6/2/2003, greg Landrum wrote:
>
>>[Boost 1.30, Win2K, MSVC v6]
>>
>>Additional information:
>> Just to verify that this is not due to my suggested changes in
>> builtin_converters.cpp::string_rvalue_from_python(), I switched that
>> code back to its previous form (without the PyString_Size argument
>> to the std::string constructor); this does not change the behavior
>> I'm observing (i.e. it still crashes ever time).
>
> I've managed to figure out a bit more of what's going on.  The
> conversion from PyObject* -> std::string is working just fine. The
> crash is happening when ~rvalue_from_python_data() calls
> python::detail::destroy_referent().  This ends up (via the
> type_traits::value_destroyer stuff) calling the destructor of the
> std::string which was built for the argument.  I'm guessing that this
> is the problem.
>
>
> I've attached relevant bits of the stack trace, if that's at all helpful.

Your example works perfectly for me with vc7.1 vc7 and vc6.5; maybe
you need a service pack?

bjam -sBUILD=debug-python -sTOOLS="vc7.1 vc7 msvc" test
BD Software STL Message Decryptor v2.38 for gcc
...found 2081 targets...
...updating 3 targets...
python-test-target c:\build\libs\python\user\bin\foo.test\vc7.1\debug-python\runtime-link-
    dynamic\foo.test
enter: foo
enter: foo
get val2:
done: 4
get val:
done: 4
Adding parser accelerators ...
Done.
[3574 refs]
python-test-target c:\build\libs\python\user\bin\foo.test\vc7\debug-python\runtime-link-
    dynamic\foo.test
enter: foo
enter: foo
get val2:
done: 4
get val:
done: 4
Adding parser accelerators ...
Done.
[3574 refs]
python-test-target c:\build\libs\python\user\bin\foo.test\msvc\debug-python\runtime-link-
    dynamic\foo.test
get val2:
Adding parser accelerators ...
Done.
enter: foo
done: 4
get val:
enter: foo
done: 4
[3574 refs]
...updated 3 targets...

Compilation finished at Wed Jun 04 09:06:35

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list