Using 'Text_FromUTF8' macro for transforming the encrypted C string to

Python string to make it Python 3 compatible.
This commit is contained in:
Ashesh Vashi 2017-07-17 10:54:50 +05:30
parent cfb0937605
commit 78eb80d0cf

View File

@ -575,8 +575,8 @@ psyco_encrypt_password(connectionObject *self, PyObject *args, PyObject *kwargs)
if (encrypted != NULL)
{
res = PyString_FromString(encrypted);
free(encrypted);
res = Text_FromUTF8(encrypted);
PQfreemem(encrypted);
}
return res;
}
@ -600,10 +600,11 @@ psyco_encrypt_password(connectionObject *self, PyObject *args, PyObject *kwargs)
}
else
{
res = PyString_FromString(encrypted);
res = Text_FromUTF8(encrypted);
PQfreemem(encrypted);
}
return res;
#else
PyErr_SetString(
NotSupportedError,