summaryrefslogtreecommitdiff
path: root/psycopg/adapter_pboolean.c
diff options
context:
space:
mode:
Diffstat (limited to 'psycopg/adapter_pboolean.c')
-rw-r--r--psycopg/adapter_pboolean.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/psycopg/adapter_pboolean.c b/psycopg/adapter_pboolean.c
index 29e3410..1ce80dd 100644
--- a/psycopg/adapter_pboolean.c
+++ b/psycopg/adapter_pboolean.c
@@ -106,8 +106,8 @@ pboolean_setup(pbooleanObject *self, PyObject *obj)
self, ((PyObject *)self)->ob_refcnt
);
+ Py_INCREF(obj);
self->wrapped = obj;
- Py_INCREF(self->wrapped);
Dprintf("pboolean_setup: good pboolean object at %p, refcnt = "
FORMAT_CODE_PY_SSIZE_T,
@@ -130,7 +130,7 @@ pboolean_dealloc(PyObject* obj)
{
pbooleanObject *self = (pbooleanObject *)obj;
- Py_XDECREF(self->wrapped);
+ Py_CLEAR(self->wrapped);
Dprintf("pboolean_dealloc: deleted pboolean object at %p, refcnt = "
FORMAT_CODE_PY_SSIZE_T,