From 11fb42887871a6196dcdf7f7c5556f1e673aceb6 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sat, 2 Jun 2018 01:02:40 +0100 Subject: [PATCH] Fix VCString return values in modpython The list of functions which returned list of unknown objects instead of list of strings: * CMessage::GetParams() * CZNC::GetMotd() * CZNC::GetTrustedProxies() * CZNC::GetBindHosts() --- modules/modpython/cstring.i | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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@*/