diff --git a/wxPython/src/my_typemaps.i b/wxPython/src/my_typemaps.i index c538e130ae..ff4994d928 100644 --- a/wxPython/src/my_typemaps.i +++ b/wxPython/src/my_typemaps.i @@ -49,6 +49,17 @@ delete $1; } +%typemap(out) wxString& { +%#if wxUSE_UNICODE + $result = PyUnicode_FromWideChar($1->c_str(), $1->Len()); +%#else + $result = PyString_FromStringAndSize($1->c_str(), $1->Len()); +%#endif +} + + +%apply wxString& { wxString* } + %typemap(out) wxString { @@ -59,25 +70,6 @@ %#endif } - -%typemap(out) wxString* { -%#if wxUSE_UNICODE - $result = PyUnicode_FromWideChar($1->c_str(), $1->Len()); -%#else - $result = PyString_FromStringAndSize($1->c_str(), $1->Len()); -%#endif -} - - -%typemap(out) wxString& { -%#if wxUSE_UNICODE - $result = PyUnicode_FromWideChar($1->c_str(), $1->Len()); -%#else - $result = PyString_FromStringAndSize($1->c_str(), $1->Len()); -%#endif -} - - %typemap(varout) wxString { %#if wxUSE_UNICODE $result = PyUnicode_FromWideChar($1.c_str(), $1.Len());