diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-07-24 17:53:53 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-07-24 17:53:53 +0200 |
| commit | 7a30c8bb4b70f42cc268b4b3a75dab5b414146c4 (patch) | |
| tree | 68e408e88214fbc006f4aa8d05d2827047a21de4 /python | |
| parent | 17427c9ba39b56c178e90fde22387d5f2ec525e1 (diff) | |
| download | python-apt-7a30c8bb4b70f42cc268b4b3a75dab5b414146c4.tar.gz | |
python/generic.h: Do not deallocate the temporary bytes object in PyUnicode_AsString.
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. |
