mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-07-28 17:10:05 +03:00
Ignore decode errors in conn_decode()
This commit is contained in:
parent
616dab7064
commit
2f7dfdd060
|
@ -126,15 +126,17 @@ conn_decode(connectionObject *self, const char *str, Py_ssize_t len)
|
|||
|
||||
if (self) {
|
||||
if (self->cdecoder) {
|
||||
return self->cdecoder(str, len, NULL);
|
||||
return self->cdecoder(str, len, "ignore");
|
||||
}
|
||||
else if (self->pydecoder) {
|
||||
PyObject *b = NULL;
|
||||
PyObject *t = NULL;
|
||||
PyObject *rv = NULL;
|
||||
static PyObject *errors = NULL;
|
||||
|
||||
if (!(b = Bytes_FromStringAndSize(str, len))) { goto error; }
|
||||
if (!(t = PyObject_CallFunctionObjArgs(self->pydecoder, b, NULL))) {
|
||||
if (!(errors = PyUnicode_FromString("ignore"))) { goto error; }
|
||||
if (!(t = PyObject_CallFunctionObjArgs(self->pydecoder, b, errors, NULL))) {
|
||||
goto error;
|
||||
}
|
||||
if (!(rv = PyTuple_GetItem(t, 0))) { goto error; }
|
||||
|
|
Loading…
Reference in New Issue
Block a user