/* Converts a python string (8-bit or unicode) to a target string in the target's charset. Returns NULL on error, with a python exception set. In Python 3, the returned object is a "bytes" object (not a string). */ PyObject * python_string_to_target_python_string (PyObject *obj) { gdbpy_ref<> str (python_string_to_unicode (obj)); if (str == NULL) return NULL; return unicode_to_target_python_string (str.get ()); }
/* Converts a python string (8-bit or unicode) to a target string in the target's charset. Returns NULL on error, with a python exception set. */ PyObject * python_string_to_target_python_string (PyObject *obj) { PyObject *str; PyObject *result; str = python_string_to_unicode (obj); if (str == NULL) return NULL; result = unicode_to_target_python_string (str); Py_DECREF (str); return result; }