diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/generic.h | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/python/generic.h b/python/generic.h index d7f121ce..75520914 100644 --- a/python/generic.h +++ b/python/generic.h @@ -79,11 +79,7 @@ typedef int Py_ssize_t; static inline const char *PyUnicode_AsString(PyObject *op) { // Convert to bytes object, using the default encoding. PyObject *bytes = PyUnicode_AsEncodedString(op,0,0); - if (!bytes) - return 0; - const char *result = PyBytes_AS_STRING(bytes); - Py_DECREF(bytes); - return result; + return bytes ? PyBytes_AS_STRING(bytes) : 0; } // Convert any type of string based object to a const char. |
