From 6520df9af996a9d8cec42c0143f65645923327b7 Mon Sep 17 00:00:00 2001 From: adustman Date: Sat, 22 Dec 2001 19:25:28 +0000 Subject: [PATCH] str() can fail in some cases, particularly unicode. Watch for it to prevent core dumps. --- MySQLdb/_mysql.c | 1 + 1 file changed, 1 insertion(+) diff --git a/MySQLdb/_mysql.c b/MySQLdb/_mysql.c index 5c02588..d067670 100644 --- a/MySQLdb/_mysql.c +++ b/MySQLdb/_mysql.c @@ -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);