minor fixes for pr749

This commit is contained in:
wmayer
2017-05-11 19:47:54 +02:00
parent e6202f46e9
commit 7394ab7277
2 changed files with 6 additions and 3 deletions

View File

@@ -285,10 +285,10 @@ PyObject* DocumentObjectPy::setExpression(PyObject * args)
PyObject* unicode = PyUnicode_AsEncodedString(expr, "utf-8", 0);
if (unicode) {
std::string exprStr = PyString_AsString(unicode);
Py_DECREF(unicode);
boost::shared_ptr<Expression> shared_expr(ExpressionParser::parse(getDocumentObjectPtr(), exprStr.c_str()));
getDocumentObjectPtr()->setExpression(p, shared_expr, comment);
Py_DECREF(unicode);
}
else {
// utf-8 encoding failed

View File

@@ -346,9 +346,12 @@ PyObject* DocumentPy::openTransaction(PyObject *args)
cmd = PyString_AsString(value);
}
#endif
else
else {
PyErr_SetString(PyExc_TypeError, "string or unicode expected");
return NULL;
getDocumentPtr()->openTransaction(cmd.c_str());
}
getDocumentPtr()->openTransaction(cmd.c_str());
Py_Return;
}