At present, class Py::String can be constructed from a const char* or
a const std::string&, but not from const char* and a size_t. We should
have a version available that takes advantage of
PyString_FromStringAndSize() by taking a length argument. This would
allow construction from a non-null-terminated character array
(especially a subset of such an array).
Also, the Py::String constructor taking a const std::string& as an
argument should not use the c_str() function to call
PyString_FromString(). Rather, it should call
PyString_FromStringAndSize( str.data(), str.length() ) // or str.size()
since we've already gone through the trouble of figuring out the
length of the contained string.
--
Steven E. Harris
Primus Knowledge Solutions, Inc.
http://www.primus.com