Change-Id: Ib62988c5351070bcade49fbfddbe01788648531d
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
return res;
}
-PyObject * utf8FromString(const char *s)
-{
-/* In Python 3, we return all strings as surrogate-escaped utf-8 */
-#if PY_MAJOR_VERSION >= 3
- if (s != NULL)
- return PyUnicode_DecodeUTF8(s, strlen(s), "surrogateescape");
-#else
- if (s != NULL)
- return PyBytes_FromString(s);
-#endif
- Py_RETURN_NONE;
-}
-
int utf8FromPyObject(PyObject *item, PyObject **str)
{
PyObject *res = NULL;
#define CAPSULE_EXTRACT(obj,name) PyCObject_AsVoidPtr(obj)
#endif
-PyObject * utf8FromString(const char *s);
+static inline PyObject * utf8FromString(const char *s)
+{
+/* In Python 3, we return all strings as surrogate-escaped utf-8 */
+ if (s != NULL)
+ return PyUnicode_DecodeUTF8(s, strlen(s), "surrogateescape");
+ Py_RETURN_NONE;
+}
#endif /* H_SYSTEM_PYTHON */