str() can fail in some cases, particularly unicode.

Watch for it to prevent core dumps.
This commit is contained in:
adustman
2001-12-22 19:25:28 +00:00
parent 913aea00f6
commit 6520df9af9

View File

@ -434,6 +434,7 @@ _mysql_string_literal(
int len, size;
if (!PyArg_ParseTuple(args, "O|O:string_literal", &o, &d)) return NULL;
s = PyObject_Str(o);
if (!s) return NULL;
in = PyString_AsString(s);
size = PyString_GET_SIZE(s);
str = PyString_FromStringAndSize((char *) NULL, size*2+3);