From 8eebdf750df72e5d787ec85bccbf90d997aa1ffc Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sat, 2 Jun 2018 10:45:03 +0100 Subject: [PATCH] Slightly cleaner way to fix #1543 --- modules/modpython/cstring.i | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/modules/modpython/cstring.i b/modules/modpython/cstring.i index 7e9ddf4c..f73e6176 100644 --- a/modules/modpython/cstring.i +++ b/modules/modpython/cstring.i @@ -7,6 +7,7 @@ Remove unrelated stuff from top of file which is included by default s/std::string/CString/g s/std_string/CString/g + Add "%traits_ptypen(CString);" */ // @@ -17,6 +18,7 @@ %feature("naturalvar") CString; class CString; +%traits_ptypen(CString); /*@SWIG:/swig/3.0.8/typemaps/CStrings.swg,70,%typemaps_CString@*/ @@ -80,15 +82,6 @@ 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@*/