mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-29 12:23:42 +03:00
Work around refcount cpychecker bug
Also increment error/code refcounts before storing in error state.
This commit is contained in:
parent
6aaecd6563
commit
2aedbedcbf
|
@ -305,12 +305,20 @@ psyco_error_setstate(errorObject *self, PyObject *state)
|
||||||
|
|
||||||
/* load the dict content in the structure */
|
/* load the dict content in the structure */
|
||||||
Py_CLEAR(self->pgerror);
|
Py_CLEAR(self->pgerror);
|
||||||
self->pgerror = PyDict_GetItemString(state, "pgerror");
|
{
|
||||||
Py_XINCREF(self->pgerror);
|
PyObject *tmp;
|
||||||
|
tmp = PyDict_GetItemString(state, "pgerror");
|
||||||
|
Py_XINCREF(tmp);
|
||||||
|
self->pgerror = TO_STATE(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
Py_CLEAR(self->pgcode);
|
Py_CLEAR(self->pgcode);
|
||||||
self->pgcode = PyDict_GetItemString(state, "pgcode");
|
{
|
||||||
Py_XINCREF(self->pgcode);
|
PyObject *tmp;
|
||||||
|
tmp = PyDict_GetItemString(state, "pgcode");
|
||||||
|
Py_XINCREF(tmp);
|
||||||
|
self->pgcode = TO_STATE(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
Py_CLEAR(self->cursor);
|
Py_CLEAR(self->cursor);
|
||||||
/* We never expect a cursor in the state as it's not picklable.
|
/* We never expect a cursor in the state as it's not picklable.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user