Skip to content

Commit

Permalink
fix regression with unicode support
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Sep 8, 2016
1 parent e15799c commit 3f2264d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/App/FeaturePythonPyImp.inl
Expand Up @@ -330,13 +330,16 @@ PyObject* FeaturePythonPyT<FeaturePyT>::addProperty(PyObject *args)
{
char *sType,*sName=0,*sGroup=0,*sDoc=0;
short attr=0;
std::string sDocStr;
PyObject *ro = Py_False, *hd = Py_False;
if (!PyArg_ParseTuple(args, "s|ssethO!O!", &sType,&sName,&sGroup,"utf-8",&sDoc,&attr,
&PyBool_Type, &ro, &PyBool_Type, &hd)) // convert args: Python->C
return NULL; // NULL triggers exception

std::string sDocStr = std::string(sDoc);
PyMem_Free(sDoc);
if (sDoc) {
sDocStr = sDoc;
PyMem_Free(sDoc);
}

Property* prop=0;
prop = FeaturePyT::getDocumentObjectPtr()->addDynamicProperty(sType,sName,sGroup,sDocStr.c_str(),attr,
Expand Down
7 changes: 5 additions & 2 deletions src/Gui/ViewProviderPythonFeaturePyImp.cpp
Expand Up @@ -67,13 +67,16 @@ PyObject* ViewProviderPythonFeaturePy::addProperty(PyObject *args)
{
char *sType,*sName=0,*sGroup=0,*sDoc=0;
short attr=0;
std::string sDocStr;
PyObject *ro = Py_False, *hd = Py_False;
if (!PyArg_ParseTuple(args, "s|ssethO!O!", &sType,&sName,&sGroup,"utf-8",&sDoc,&attr,
&PyBool_Type, &ro, &PyBool_Type, &hd)) // convert args: Python->C
return NULL; // NULL triggers exception

std::string sDocStr = std::string(sDoc);
PyMem_Free(sDoc);
if (sDoc) {
sDocStr = sDoc;
PyMem_Free(sDoc);
}

App::Property* prop=0;
prop = getViewProviderPythonFeaturePtr()->addDynamicProperty(sType,sName,sGroup,sDocStr.c_str(),attr,
Expand Down

0 comments on commit 3f2264d

Please sign in to comment.