You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -108,6 +108,7 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec
108
108
Py_ssize_tbuflen;
109
109
PyObject*stringval;
110
110
parameter_typeparamtype;
111
+
char*c;
111
112
112
113
if (parameter==Py_None) {
113
114
rc=sqlite3_bind_null(self->st, pos);
@@ -140,6 +141,17 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec
140
141
paramtype=TYPE_UNKNOWN;
141
142
}
142
143
144
+
if (paramtype==TYPE_STRING&& !allow_8bit_chars) {
145
+
string=PyString_AS_STRING(parameter);
146
+
for (c=string; *c!=0; c++) {
147
+
if (*c&0x80) {
148
+
PyErr_SetString(pysqlite_ProgrammingError, "You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.");
149
+
rc=-1;
150
+
goto final;
151
+
}
152
+
}
153
+
}
154
+
143
155
switch (paramtype) {
144
156
caseTYPE_INT:
145
157
longval=PyInt_AsLong(parameter);
@@ -197,7 +209,7 @@ static int _need_adapt(PyObject* obj)
0 commit comments