[C++-sig] vector_indexing_suite and std::string
Jonathan Brandmeyer
jbrandmeyer at earthlink.net
Wed Mar 17 00:16:13 CET 2004
On Tue, 2004-03-16 at 11:25, greg Landrum wrote:
> The attached files create and test an extension module that uses the indexing_suite to return std::vectors containing ints and std::strings to Python. The int vectors work just fine, but the std::string vectors generate:
> TypeError: No Python class registered for C++ class std::string
> errors when the individual elements are accessed.
>
> It's clearly not a problem with returning std::strings, because the bareString() function does that without any difficulties.
>
> Ron Clarke posted about this a couple of weeks ago:
> http://mail.python.org/pipermail/c++-sig/2004-March/006966.html
> but no solution or work-around was provided, so I figured I'd try again.
>
> System details:
> Boost: 1.31
> Python: 2.2.3
> OS: both Redhat8.0 (g++ v3.2)and Win2K (VC++ 7.1)
>
> Thanks,
> -greg
Its not in the indexing suite, per se, its a problem with the
implementation of register_ptr_to_python(). Here is a test that
demonstrates the problem. Kindly ignore the memory leak, its just for
demonstration purposes.
HTH,
Jonathan Brandmeyer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrap_test.cpp
Type: text/x-c++
Size: 869 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20040316/d3d79ba9/attachment.bin>
More information about the Cplusplus-sig
mailing list