X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=gdcmPython%2Fgdcm.i;h=399f6f4fbcfaf4da12cf156d3195bf2afac34965;hb=9317c3709915a7fd018c6d45c2426a2047931de7;hp=4148b71780c776559625cad09051f209916b430d;hpb=018a3bbd1c375f4fdb1970cfc23f61b4fe04eb20;p=gdcm.git diff --git a/gdcmPython/gdcm.i b/gdcmPython/gdcm.i index 4148b717..399f6f4f 100644 --- a/gdcmPython/gdcm.i +++ b/gdcmPython/gdcm.i @@ -281,11 +281,21 @@ typedef unsigned long long uint64_t; //////////////////// STL string versus Python str //////////////////////// // Convertion returning a C++ string. -%typemap(out) string, std::string +%typemap(out) std::string { $result = PyString_FromString(($1).c_str()); } +%typemap(out) string +{ + $result = PyString_FromString(($1).c_str()); +} + +%typemap(out) std::string const & +{ + $result = PyString_FromString(($1)->c_str()); +} + // Convertion of incoming Python str to STL string %typemap(python, in) const std::string, std::string {