| static PyObject * |
| _mysql_string_literal( |
| _mysql_ConnectionObject *self, |
| PyObject *args) |
| { |
| PyObject *str, *s, *o, *d; |
| char *in, *out; |
| int len, size, isbytes; |
| if (!PyArg_ParseTuple(args, "O|O:string_literal", &o, &d)) return NULL; |
| // TODO: Would be better to *only* accept bytes here. |
| isbytes = PyBytes_Check(o); |
| if (isbytes) { |
| s = o; |
| } else if (PyUnicode_Check(o)) { |
| s = PyUnicode_AsEncodedString(o, "UTF-8", "strict"); |
| } else { |
| s = PyObject_Bytes(o); |
| } |
| if (!s) return NULL; |
| in = PyBytes_AS_STRING(s); |
| size = PyBytes_GET_SIZE(s); |
| str = PyBytes_FromStringAndSize((char *) NULL, size*2+3); |
| if (!str) return PyErr_NoMemory(); |
| out = PyBytes_AS_STRING(str); |
| #if MYSQL_VERSION_ID < 32321 |
| len = mysql_escape_string(out+1, in, size); |
| #else |
| len = mysql_real_escape_string(utf8conn, out+1, in, size); |
| #endif |
| *out = *(out+len+1) = '\''; |
| if (_PyBytes_Resize(&str, len+2) < 0) return NULL; |
| if (!isbytes) { |
| Py_DECREF(s); |
| } |
| return (str); |
| } |
was expecting final owned ob_refcnt of '*s' to be 0 since nothing references it but final ob_refcnt is refs: 1 owned
found 3 similar trace(s) to this
when PyArg_ParseTuple() succeeds
taking False path
when treating unknown struct _typeobject * from _mysql.c:1117 as non-NULL
when considering value == (long int)0 from _mysql.c:1117
taking False path
when treating unknown struct _typeobject * from _mysql.c:1120 as non-NULL
when considering value == (long int)0 from _mysql.c:1120
taking False path
when PyObject_Str() succeeds
'*s' was allocated at: s = PyObject_Bytes(o);
taking False path
when PyString_FromStringAndSize() succeeds
taking False path
when treating unknown char * from _mysql.c:1137 as non-NULL
when considering range: -0x80000000 <= value <= -1
taking True path
| static PyObject * |
| _mysql_string_literal( |
| _mysql_ConnectionObject *self, |
| PyObject *args) |
| { |
| PyObject *str, *s, *o, *d; |
| char *in, *out; |
| int len, size, isbytes; |
| if (!PyArg_ParseTuple(args, "O|O:string_literal", &o, &d)) return NULL; |
| // TODO: Would be better to *only* accept bytes here. |
| isbytes = PyBytes_Check(o); |
| if (isbytes) { |
| s = o; |
| } else if (PyUnicode_Check(o)) { |
| s = PyUnicode_AsEncodedString(o, "UTF-8", "strict"); |
| } else { |
| s = PyObject_Bytes(o); |
| } |
| if (!s) return NULL; |
| in = PyBytes_AS_STRING(s); |
| size = PyBytes_GET_SIZE(s); |
| str = PyBytes_FromStringAndSize((char *) NULL, size*2+3); |
| if (!str) return PyErr_NoMemory(); |
| out = PyBytes_AS_STRING(str); |
| #if MYSQL_VERSION_ID < 32321 |
| len = mysql_escape_string(out+1, in, size); |
| #else |
| len = mysql_real_escape_string(utf8conn, out+1, in, size); |
| #endif |
| *out = *(out+len+1) = '\''; |
| if (_PyBytes_Resize(&str, len+2) < 0) return NULL; |
| if (!isbytes) { |
| Py_DECREF(s); |
| } |
| return (str); |
| } |
was expecting final owned ob_refcnt of '*str.35' to be 0 since nothing references it but final ob_refcnt is refs: 1 owned
found 7 similar trace(s) to this
when PyArg_ParseTuple() succeeds
taking False path
when treating unknown struct _typeobject * from _mysql.c:1117 as non-NULL
when considering value == (long int)0 from _mysql.c:1117
taking False path
when treating unknown struct _typeobject * from _mysql.c:1120 as non-NULL
when considering value == (long int)0 from _mysql.c:1120
taking False path
when PyObject_Str() succeeds
taking False path
when PyString_FromStringAndSize() succeeds
'*str.35' was allocated at: str = PyBytes_FromStringAndSize((char *) NULL, size*2+3);
taking False path
when treating unknown char * from _mysql.c:1137 as non-NULL
when considering range: -0x80000000 <= value <= -1
taking True path
| static PyObject * |
| _mysql_string_literal( |
| _mysql_ConnectionObject *self, |
| PyObject *args) |
| { |
| PyObject *str, *s, *o, *d; |
| char *in, *out; |
| int len, size, isbytes; |
| if (!PyArg_ParseTuple(args, "O|O:string_literal", &o, &d)) return NULL; |
| // TODO: Would be better to *only* accept bytes here. |
| isbytes = PyBytes_Check(o); |
| if (isbytes) { |
| s = o; |
| } else if (PyUnicode_Check(o)) { |
| s = PyUnicode_AsEncodedString(o, "UTF-8", "strict"); |
| } else { |
| s = PyObject_Bytes(o); |
| } |
| if (!s) return NULL; |
| in = PyBytes_AS_STRING(s); |
| size = PyBytes_GET_SIZE(s); |
| str = PyBytes_FromStringAndSize((char *) NULL, size*2+3); |
| if (!str) return PyErr_NoMemory(); |
| out = PyBytes_AS_STRING(str); |
| #if MYSQL_VERSION_ID < 32321 |
| len = mysql_escape_string(out+1, in, size); |
| #else |
| len = mysql_real_escape_string(utf8conn, out+1, in, size); |
| #endif |
| *out = *(out+len+1) = '\''; |
| if (_PyBytes_Resize(&str, len+2) < 0) return NULL; |
| if (!isbytes) { |
| Py_DECREF(s); |
| } |
| return (str); |
| } |
found 2 similar trace(s) to this
when PyArg_ParseTuple() succeeds
taking False path
when treating unknown struct _typeobject * from _mysql.c:1117 as non-NULL
when considering value == (long int)0 from _mysql.c:1117
taking False path
when treating unknown struct _typeobject * from _mysql.c:1120 as non-NULL
when considering value == (long int)0 from _mysql.c:1120
taking False path
when PyObject_Str() succeeds
taking False path
when PyString_FromStringAndSize() succeeds
taking False path
when treating unknown char * from _mysql.c:1137 as non-NULL
when considering range: -0x80000000 <= value <= -1
taking True path