Skip to content

Commit

Permalink
py3: python3-related fix in Spreadsheet
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre authored and wwmayer committed Feb 18, 2017
1 parent 3d3a8d0 commit 3efc4fe
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Mod/Spreadsheet/App/SheetPyImp.cpp
Expand Up @@ -477,9 +477,18 @@ PyObject* SheetPy::setAlias(PyObject *args)

try {
address = stringToAddress(strAddress);

if (PyString_Check(value))
if (PyUnicode_Check(value))
#if PY_MAJOR_VERSION >= 3
getSheetPtr()->setAlias(address, PyUnicode_AsUTF8(value));
#else
{
PyObject* unicode = PyUnicode_AsUTF8String(value);
v = QString::fromUtf8(PyString_AsString(unicode));
Py_DECREF(unicode);
}
else if (PyString_Check(value))
getSheetPtr()->setAlias(address, PyString_AsString(value));
#endif
else if (value == Py_None)
getSheetPtr()->setAlias(address, "");
else
Expand Down

0 comments on commit 3efc4fe

Please sign in to comment.