mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-15 19:31:54 +08:00
str() can fail in some cases, particularly unicode.
Watch for it to prevent core dumps.
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user