diff --git a/modules/modpython/cstring.i b/modules/modpython/cstring.i index bc081f7e..7e9ddf4c 100644 --- a/modules/modpython/cstring.i +++ b/modules/modpython/cstring.i @@ -74,12 +74,21 @@ SWIG_AsVal_CString (PyObject * obj, CString *val) } /*@SWIG@*/ /*@SWIG:/swig/3.0.8/typemaps/CStrings.swg,38,%CString_from@*/ -%fragment("SWIG_" "From" "_" {CString},"header",fragment="SWIG_FromCharPtrAndSize") { +%fragment("SWIG_" "From" "_" {CString},"header",fragment="SWIG_FromCharPtrAndSize", fragment="StdTraits") { SWIGINTERNINLINE PyObject * SWIG_From_CString (const CString& s) { return SWIG_FromCharPtrAndSize(s.data(), s.size()); } + +namespace swig { + template<> + struct traits_from { + static PyObject* from(const CString& s) { + return SWIG_From_CString(s); + } + }; +} } /*@SWIG@*/