diff --git a/src/App/DocumentPyImp.cpp b/src/App/DocumentPyImp.cpp index 2f0d15cf0..ef72547df 100644 --- a/src/App/DocumentPyImp.cpp +++ b/src/App/DocumentPyImp.cpp @@ -319,10 +319,18 @@ PyObject* DocumentPy::moveObject(PyObject *args) PyObject* DocumentPy::openTransaction(PyObject *args) { + PyObject *value; + if (!PyArg_ParseTuple(args, "|O",&value)) + return NULL; // NULL triggers exception char *pstr=0; - if (!PyArg_ParseTuple(args, "|s", &pstr)) // convert args: Python->C - return NULL; // NULL triggers exception - + if (PyUnicode_Check(value)) { + PyObject* unicode = PyUnicode_AsLatin1String(value); + pstr = PyString_AsString(unicode); + Py_DECREF(unicode); + } + else if (PyString_Check(value)) { + pstr = PyString_AsString(value); + } getDocumentPtr()->openTransaction(pstr); Py_Return; }